Format
BUFR is a binary data format, that was introduced by the World Meteorological Organization (WMO) to universally store meteorological observation data. It is very flexible and powerful, but can be quite complex to handle. You can read this introduction to get an idea of what it is.
In short, a BUFR file can contain multiple messages, each of which can contain multiple subsets where the data is stored with its metadata and can be read by its respective key. Here we use keys from the WMO element table 40 to read the data. To inspect your BUFR files we recommend using either bufr tools or the metview software. These are provided by ECMWF and therefore rely on the same BUFR reading library (ecCodes) as MeteoIO.
Prior to reading the data a scan of the file is done, to find all stations in the file together with their metadata and to check if it is valid (we require a position (lat,lon,alt) and a station ID). If no station ID but a station Name is found, we use this as station ID. Additionally we require unique timepoints per station. So far only reading parameters known to MeteoIO is supported (if you need to read additional parameters, please contact the developers, as this is an option that could be supported).
- Note
- This plugin requires the ecCodes library in version 2.27.0 or greater to be installed. It is available at ecCodes
Writing Bufr files
It is also possible to write BUFR files. However, only writing known parameters is supported. However, it is possible to write profiles (of heights) of some parameters, i.e. air temperature, pressure and relative humidity. To do that, the parameters at different heights need to be named as {parameter name}measurement height}, for example like "TA@2" and "TA@10" for air temperatures at 2 and 10m respectively (this naming scheme has to be applied when reading the data in the [Input] section). The profile will then be written with a repetition of the parameter together with its associated heights.
The filenames are generated on the fly, as meteoio_{timestamp}.bufr, where the timestamp is the current date and time. Each datapoint is its own message as it is not possible to create subsets with eccodes.
Keywords
This plugin uses the following keywords: [Input]:
- METEOPATH: Path to the BUFR files
- BUFREXT: Extension of the BUFR files (default: .bufr)
- STATION#: File name per station
- ADDITIONAL_PARAMS: Additional parameters to read from the BUFR file, as a comma separated list of WMO element Table B keys (currently WMO Table B v40)
- FALLBACKTZ: Fallback timezone in hours, if no timezone information is found in the BUFR file (default: GMT+0)
- VERBOSE: Print additional information during reading (default: false) [Output]:
- METEOPATH: Path to the BUFR files to be written
- SEPARATESTATIONS: Write each station to a separate file (default: false)
- SNOWDEPTHMETHOD: Method of snow depth measurement, eg 1: Ultrasonic method, 15: Missing value [default]; see <a href="https://vocabulary-manager.eumetsat.int/vocabularies/BUFR/WMO/41/TABLE_CODE_FLAG/002177>Code Table 2177</a
@section bufrio_example Example
@code
[INPUT]
METEO = BUFR
METEOPATH = path/to/bufr/files
BUFREXT = .bfr
ADDITIONAL_PARAMS = airTemperature, dewPointTemperature
STATION1 = example.bfr
VERBOSE = TRUE
[OUTPUT]
METEO = BUFR
METEOPATH = path/to/output
SEPARATESTATIONS = TRUE
@endcode
@section bufrio_cryo Cryo Station
The Cryo Station is a specific BUFR Template for Cryospheric Stations containing snow/ice.. profiles. It is possible to write those, by setting
<i>CRYOSTATION = TRUE</i> in the output section. The following additional keywords are required in the [Output] section:
- WIGOSIDSERIES: WIGOS ID Series (0-15)
- WIGOSISSUER: WIGOS Issuer
- WIGOSISSUENO: WIGOS Issue Number
- WIGOSLOCALID: WIGOS Local ID
- STATIONTYPE: Station Type (default: 3)
- SURFACETYPE: Surface Type (default: 255)
The station type and surface type are WMO codes, and can be found in the <a href="https://confluence.ecmwf.int/display/ECC/WMO%3D40+code-flag+table#WMO=40codeflagtable-CF_008018">Flag Tables</a>
@subsection allowed_params Supported Parameters
The Cryo Station follows a specific template, where some parameters are not MeteoIO standard parameters. Additionally, some MeteoIO parameters are
not supported by the Cryo Station (e.g. VW, ISWR...). Therefore we list the parameters that can be written, with their representation in MeteoIO
(which should be the parameter name in the input file).
@note Be careful when using TSS and TSURFACE simultaneously, as this will lead to undefined behaviour!
<center><table border="1">
<tr><th colspan="3">Single parameters</th><th colspan="3">Parameters suitable for profiles</th></tr>
<tr><th>Parameter name</th><th>Description</th><th>Reference</th><th>Parameter name</th><th>Description</th><th>Reference</th></tr>
<tr><td>ICE_THICKNESS</td><td>Ice Thickness in m</td><td></td> <td>SENSORTYPE</td><td>Sensor Type</td><td><a href="https://confluence.ecmwf.int/display/ECC/WMO%3D40+code-flag+table#WMO=40codeflagtable-CF_002096">Flag table</a></td></tr>
<tr><td>GROUNDSTATE</td><td>Ground State</td><td><a href="https://vocabulary-manager.eumetsat.int/vocabularies/BUFR/WMO/40/TABLE_CODE_FLAG/020062">Bufr table</a></td> <td>TA</td><td>Air Temperature</td><td>meteoio</td></tr>
<tr><td>HS</td><td>Snow Depth in m</td><td>meteoio</td> <td>TSNOW</td><td>Snow Temperature</td><td></td></tr>
<tr><td>SURFACEQUALIFIER</td><td>Surface Qualifier for Temperature Data</td><td><a href="https://vocabulary-manager.eumetsat.int/vocabularies/BUFR/WMO/40/TABLE_CODE_FLAG/008010">Bufr table</a></td> <td>TSOIL</td><td>Soil Temperature in K</td><td>meteoio</td></tr>
<tr><td>TSS</td><td>Skin/Surface Temperature in K</td><td>meteoio</td> <td>TWATER</td><td>Water Temperature in K</td><td></td></tr>
<tr><td></td><td></td><td></td> <td>TICE</td><td>Ice Temperature in K</td><td></td></tr>
</table></center>
@subsection bufrio_cryo_surface Surface Type
Available surface types are summarized in the table below.
<center><table border="1">
Surface type code
Description
Surface type code
Description
0
open ocean or semi-enclosed sea
12
lake
1
enclosed sea or lake
13
sea
2
continental ice
14
glacier
3
land
15
urban land
4
low inland (below sea level)
16
rural land
5
mix of land and water
17
suburban land
6
mix of land and low inland
18
sea ice
11
river
255
missing value
Station Type
Available station types are:
- 0: Automatic
- 1: Manned
- 2: Hybrid
- 3: Missing Value
Snow Depth Method
Available snow depth methods can be found at https://confluence.ecmwf.int/display/ECC/WMO%3D40+code-flag+table#WMO=40codeflagtable-CF_002177
- Note
- the given flags in these sub section might be outdated, as this is not regularly updated
Developer Notes
If additional parameters need to be written to BUFR:
- Add the parameter to the constant maps in libcodes.cc
- Make Sure to handle specifics of parametrs in setMeteoData or setCryoData
- Add the parameter to the POSSIBLE_MULTIPLE_PARAMETERS vector if needed The descriptor can be complete BUFR sequences, however, as soon as a parameter appears twice in two different sequences, it will silentyly fail, and only the first descriptor is used. So be careful that each parameter only appears once.
- We might need the flexibility to add parameters outside of the cryo template, a way to flexibly add standard parameters
- Todo:
- The Cryo parameters which will be added to the WMO table need to be changed when available ( look for TODO in libcodes.cc)
For now Wigos id... metadata has to be set by ini, maybe make it available as StationData Additionally, some parameters from the Cryo Station are not standard parameters, so they wont be handled-> needs a solution
- Note
- If writing arbitrary parameters is required, we need descriptors and parameter keys, which are not hardcoded
- Todo:
- map precip type from code to...