Content from
https://confluence-test.ecmwf.int/display/ECC/Frequently+Asked+Questions
Summary
-
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 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: -
Is ecCodes thread-safe - ecCodes FAQ —
Great care has been taken to ensure this. Note: the package needs to be built with either Pthreads (POSIX Threads) or OpenMP support.
-
Keys and their types - ecCodes GRIB FAQ —
Some keys like shortName are strings (native type "string") and it doesn't make any sense to set them as an integer or float as they are not possible values for the key.
-
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
-
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
-
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
-
What happens when I set the packingType to grid_jpeg on a GRIB1 message - ecCodes GRIB FAQ —
Actually nothing! JPEG packing is not supported for GRIB edition 1 but rather than fail, the library leaves the message as is.
-
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).
-
What is the GRIB bitmap - ecCodes GRIB FAQ —
The bitmap is an array of binary values. Its purpose is to indicate the presence or absence of data at each of the grid points. A value of '0' means data is missing and a '1' means data is present.
Note: The bitmap section is optional. If it is not present, it means every grid point has an associated value. -
Issues converting from grid_complex_spatial_differencing to simple packing - ecCodes GRIB FAQ —
This article relates to GRIB edition 2
There are GRIB messages whose packingType is "grid_complex_spatial_differencing" where the missing values are not in a bitmap but stored in the Data Section (as coded values).
In these cases conversion to simple packing can fail.A workaround is to set the key "bitmapPresent" to 1 before the conversion. This ensures a bitmap is created for the output GRIB and the missing values correctly stored:
-
How do I use an OR condition (logical disjunction) in a where clause - ecCodes GRIB FAQ —
For example in grib_get you may want to show all messages which have a level of 100, 150 or 200.
-
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.
-
How can I find out which keys can be set to "missing" - ecCodes GRIB FAQ —
If you take the sample GRIB file "GRIB2.tmpl" and dump it, you can see which keys are MISSING (i.e., their values are all 1's) but it is not possible to see which keys can be MISSING. So for example take the key "iDirectionIncrement":
% grib_dump -O GRIB2.tmpl ... iDirectionIncrement = 2000000 ...
So in this case its value is not MISSING but it is possible for this value to be MISSING. This is not indicated here.