MeteoIODoc 20240411.d3bdb3cb

This plugin reads the meteorological forecast data from COSMO either as gridded data or downscaled for each of the Swiss meteorological networks IMIS/ANETZ stations as preprocessed by the Operational Snow-Hydrological Service of the WSL/SLF. The data is written as Matlab binary files (.mat), one per timestep for all stations and meteorological parameters, available on an access-controlled server after each new COSMO run. It therefore requires a third party library to read this file format: the Open Source MatIO library. This can be installed directly from the default repositories under Linux or installed by downloading the proper package for Windows or OsX.

If non-ascii characters have been used and the file has been created under Windows, some of the strings might end up using the UTF-16 encoding. This requires a recent version of libmatio (see this issue). Another option would be to add at the beginning of the Matlab routine a call to feature('DefaultCharacterSet', 'UTF8') in order to switch from the current default (which can be read by the same call, ommitting the 'UTF8' option) to the (partial) UTF-8 encoding of Matlab.

Data structure

The files are named with the following schema: COSMODATA_{timestep}_{cosmo model version}{mode}_{runtime}.{meteo_ext} with the following possible values:

  • timestep is written as purely numeric ISO with minute resolution;
  • cosmo model version is currently C1E;
  • mode is a one letter code (FC for Forecast);
  • run time is the purely numeric ISO date and time of when COSMO produced the dataset;
  • meteo_ext is currently .mat.

The station data files have the following internal data structure (represented as "name {data type}" and with meteo parameter as one of prcs, wnss, wnds, wnsc, lwrc, sdri, sdrd, sdfd, tais, taic, rhus, pais, pail):

       ├── acro {1x688 array of arrays of char variable}
       ├── NODATA_value {1x1 double variable}
       ├── meteo parameter {struct}
       │   ├── data {1x688 array of doubles variable}
       │   ├── name {array of char variable}
       │   ├── unit {array of char variable}
       │   └── source {array of char variable}
       ├── … more meteo parameters
       └── time {1x2 array of doubles variable}

The stations' acronyms follow a fixed order but their coordinates must be provided in a separate file, given as METAFILE key (see below). If the number of stations in this list does not match the number of stations declared in one of the meteorological file, an exception will be thrown. This file must have the following structure (the x and y coordinates being the CH1903 easting and northing, respectively):

     statlist {1x1 struct}
       ├── acro {1x688 array of arrays of char variable}
       ├── name {1x688 array of arrays of char variable}
       ├── x {1x688 array of doubles variable}
       ├── y {1x688 array of doubles variable}
       ├── z {1x688 array of doubles variable}
       └── … various other arrays

The gridded data have the following structure:

     grid {1x1 struct}
       ├── ncols {1x1 array of doubles}
       ├── nrows {1x1 array of doubles}
       ├── xllcorner {1x1 array of doubles}
       ├── yllcorner {1x1 array of doubles}
       ├── cellsize {1x1 array of doubles}
       ├── NODATA_value {1x1 array of doubles}
       ├── data {nrows x ncols array of double}
       └── desc {array of char}


This plugin uses the following keywords:

  • COORDSYS: coordinate system (see Coords); [Input] and [Output] section
  • COORDPARAM: extra coordinates parameters (see Coords); [Input] and [Output] section
  • METEOPATH: directory containing all the data files with the proper file naming schema; [Input] section
  • METEOPATH_RECURSIVE: should meteopath be searched recursively for files? (default: false); [Input] section
  • STATION#: input stations' IDs (in METEOPATH). As many stations' IDs as needed may be specified
  • METAFILE: file containing the stations' IDs, names and location; [Input] section (either within METEOPATH if not path is provided or within the provided path)
  • DEMFILE: for reading the data as a DEMObject
  • GRID2DPATH: meteo grids directory where to read/write the grids; [Input] and [Output] sections
  • GRIDPATH_RECURSIVE: if set to true, grids will be searched recursively in GRID2DPATH (default: false)
  • OSHD_DEBUG: write out extra information to better show what is in the files

Example use

METAFILE = STAT_LIST.mat ;another possibility could be /local/metadata/STAT_LIST.mat