MeteoIODoc 20240411.d3bdb3cb


This plugin reads the XML files as generated by Cosmo's FieldExtra. The files are written out by COSMO in Grib format and preprocessed by FieldExtra (MeteoSwiss) to get XML files. It requires libxml2 to compile and run. It also assumes that the station IDs are unique (ie two data sets with the same station ID are considered to belong to the same station).


This plugin has been developed primarily for reading XML files produced by COSMO ( at MeteoSwiss. COSMO (COnsortium for Small scale MOdelling) represents a non-hydrostatic limited-area atmospheric model, to be used both for operational and for research applications by the members of the consortium. The Consortium has the following members:

  • Germany, DWD, Deutscher Wetterdienst
  • Switzerland, MCH, MeteoSchweiz
  • Italy, USAM, Ufficio Generale Spazio Aereo e Meteorologia
  • Greece, HNMS, Hellenic National Meteorological Service
  • Poland, IMGW, Institute of Meteorology and Water Management
  • Romania, NMA, National Meteorological Administration
  • Russia, RHM, Federal Service for Hydrometeorology and Environmental Monitoring
  • Germany, AGeoBw, Amt für GeoInformationswesen der Bundeswehr
  • Italy, CIRA, Centro Italiano Ricerche Aerospaziali
  • Italy, ARPA-SIMC, ARPA Emilia Romagna Servizio Idro Meteo Clima
  • Italy, ARPA Piemonte, Agenzia Regionale per la Protezione Ambientale Piemonte


The units are assumed to be the following:

  • temperatures in K
  • relative humidity in %
  • wind speed in m/s
  • precipitations in mm/h
  • radiation in W/m²
  • snow height in cm
  • maximal wind speed in m/s


This plugin uses the following keywords:

  • COORDSYS: input coordinate system (see Coords) specified in the [Input] section
  • METEO: specify COSMOXML for [Input] section
  • METEOPATH: string containing the path to the xml files to be read, specified in the [Input] section
  • METEOFILE: specify the xml file to read the data from (optional)
  • METEO_PREFIX: file name prefix appearing before the date (optional)
  • METEO_EXT: file extension (default: ".xml", give "none" to get an empty string)
  • STATION#: ID of the station to read
  • IMIS_STATIONS: if set to true, all station IDs provided above will be stripped of their number (to match MeteoCH naming scheme)
  • USE_MODEL_LOC: if set to false, the true station location (lat, lon, altitude) is used. Otherwise, it uses the model location (default)
  • XML_ENCODING: force the input file encoding, overriding the file's own encoding declaration (optional, see XML encoding below)

If no METEOFILE is provided, all ".xml" files in the METEOPATH directory will be read, if they match the METEO_PREFIX and METEO_EXT. They must contain the date of the first data formatted as ISO8601 numerical UTC date in their file name. For example, a file containing simulated meteorological fields from 2014-03-03T12:00 until 2014-03-05T00:00 could be named such as "cosmo_201403031200.xml" If some numbers appear before the numerical date, they must be provided as part of METEO_PREFIX so the plugin can properly extract the date (for MeteoSwiss, this must be set to "VNMH49").


METEOPATH = ./input/meteoXMLdata
METEOFILE = cosmo2.xml

XML encoding

Each XML document should specify its encoding. However this information might sometimes be missing or even worst, be false. This makes the XML document non-compliant. Normally, COSMOXML reads the file encoding in the file itself. If this does not work (one of the two cases given above), it is possible to force the encoding of the input file by using the "XML_ENCODING" option. This option takes one of the following values ("LE" stands for "Little Endian" and "BE" for "Big Endian"):

  • for UTF/UCS: UTF-8, UTF-16-LE, UTF-16-BE, UCS-4-LE, UCS-4-BE, UCS-4-2143, UCS-4-3412, UCS-2, EBCDIC
  • for ISO-8859: ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9
  • for Japanses: ISO-2022-JP, SHIFT-JIS, EUC-JP
  • for ascii: ASCII