meteociel.cities.generate_database
- meteociel.cities.generate_database()
Generate a JSON database with all known cities from Météociel. The name of this database is set by the constant
cities.DATABASE_NAME. For each city, a dict of the following form is created:city_id: { "names" : ["name1", "name2", ...], "has-sounding": bool (True or False) "has-station" : ``bool`` (True or False), "station-type": can be "synop", "metar", "secondaire", "amateur", "inactive" or "N/A" if no station "country" : ``the`` country can be "N/A" if unknown }Types of station:
synopare main stations;metarare stations used by aviation;secondaireare secondary stations;amateurare stations maintained by non-professionnal;inactiveare stations that doesn’t emit anymore.
Warning
This function need to gather thousand cities, so its execution can take several seconds.
Exemples
>>> from meteociel.cities import generate_database >>> generate_database()