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:

  • synop are main stations;

  • metar are stations used by aviation;

  • secondaire are secondary stations;

  • amateur are stations maintained by non-professionnal;

  • inactive are 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()