Content from
https://confluence-test.ecmwf.int/display/ECC/Frequently+Asked+Questions
Summary
-
Order of setting fixed surface keys - ecCodes GRIB FAQ —
This article relates to GRIB edition 2
Problem
Setting the fixed surface keys in the wrong order can lead to incorrect values.
-
How do I decode messages from a byte stream - ecCodes FAQ —
You have a URL which contains GRIB/BUFR message(s) and you want to read them directly from the web without first saving to disk.
Step-by-step guide
Let's say you have a stream of in-memory bytes rather than a file which contains one or more GRIB or BUFR messages. You can of course save those bytes to a file and decode as usual but what if you have a slow filesystem, your disk is full or you just want to avoid the disk access overhead?
The following python script shows you how you can decode those messages: -
MEMFS: How do I access the samples in ifs_samples - ecCodes GRIB FAQ —
Problem
If you try to load the samples file "gg_ml.tmpl", it can fail because that one is not in the usual samples location but in "ifs_samples". Normally you extend the ECCODES_SAMPLES_PATH to include the ifs_samples directory. But with MEMFS the samples (and also definitions) are not installed (instead they are all embeddedwithin the library.
-
Why are there sometimes small negative precipitation accumulations - ecCodes GRIB FAQ —
Occasionally, we receive reports of negative precipitation totals being computed from IFS output encoded in GRIB. Although such reports often refer to "negative precipitation accumulation", the same issue can affect any field accumulated from the start of the forecast and small but spurious positive accumulations are also possible. Positive accumulations can lead to small increases in, say, solar radiation during night time hours when a zero increase is expected. This document explains both why this happens and the circumstances in which it occurs.
-
How can I remove the data values and bitmap - ecCodes GRIB FAQ —
This can be done by using the -d option as shown:
% grib_set -d0 in.grib out.grib
-
Creating your own local parameters - ecCodes GRIB FAQ —
Local parameters are required when one needs to store information which is not part of the standard definitions.
-
Creating your own local definitions - ecCodes GRIB FAQ —
Local definitions are required when one needs to store information which is not part of the standard GRIB header. This might be local parameters or local definitions.
-
Python3: codes_write error: 'argument must be str, not bytes' - ecCodes FAQ —
Problem
When trying to write out a GRIB or BUFR message to a file using codes_write, an error is generated (an exception is thrown)
Solution
-
How can I convert a multi-field GRIB file to single-field - ecCodes GRIB FAQ —
This article relates to GRIB edition 2
Step-by-step guide
To convert multi-field GRIB messages into single-field, you can use the grib_copy command.
For example here we have a multi-field GRIB2 file with 30 messages some of which contain several fields. The grib_copy command creates a new file in which every message has a single field: -
grib_to_netcdf: skips Control Forecast when I convert Ensemble Forecast data - ecCodes GRIB FAQ —
If you have a file with both Control and Perturbed forecasts, grib_to_netcdf will only convert the pf. Normally from 51 members in the GRIB file, only 50 appear in the netCDF.
-
grib_to_netcdf: Why do I get the error "Wrong number of fields... Try using the -T option" - ecCodes GRIB FAQ —
You try to retrieve data from the ECMWF data archive in netCDF format but the retrieval fails with this message
-
Why I cannot set negative values for the longitude in GRIB 2 - ecCodes GRIB FAQ —
GRIB 1 regulates that the longitude can be in either [-180, 180] or [0,360], GRIB 2 regulates that the longitude can only be in the interval [0,360]
-
Why can I read certain parameters using the grib tools, but not from my program - ecCodes GRIB FAQ —
Your file may be encoded as a multi-field GRIB file. By default, grib tools have multi-field support enabled and the API disabled.
-
How to install ecCodes with Python bindings in conda - ecCodes FAQ —
This guide describes how to install ecCodes with Python bindings in a conda environment (Note: Python here means Python 3; Python 2 is deprecated).
Step-by-step guide
If you do not already have a conda environment installed on your system, the simplest is to download a miniforge installer for your platform
-
Why do I get a bitmap even though none of my values are missing - ecCodes GRIB FAQ —
If you encode data in a GRIB message and none of the values are actually missing, you can still end up with a Bitmap Section.
Step-by-step guide
If you encode data in GRIB and set the key "bitmapPresent" to 1, you will get a Bitmap Section in your message. If none of the values encoded match the "missingValue" key (by default 9999) then you will end up with a bitmap with all entries being 1 (data is present). This can add weight to the message (There is a single bit for each data value, therefore a data array of N points requires N/8 bytes for the bitmap array).