Content from
https://confluence-test.ecmwf.int/display/ECC/Frequently+Asked+Questions
Summary
-
When decoding compressed data, ecCodes does not expand elements whose values are constant across all subsets - ecCodes BUFR FAQ —
When decoding compressed BUFR data, ecCodes does not expand elements whose values are constant across all subsets, i.e. it returns a single value rather than an array of constant values. When this environment variable is set to 1, that behaviour is changed so all values are shown.
$ export ECCODES_BUFR_MULTI_ELEMENT_CONSTANT_ARRAYS=1
-
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.
-
What is CCSDS/AEC packing and how I can set it - ecCodes GRIB FAQ —
AEC is an implementation of CCSDS compression using libaec.
CCSDS stands for Consultative Committee for Space Data Systems and is a WMO standard for lossless data compression (Data representation template 5.42)Note: This is only available in GRIB edition 2
To encode with this packing type:
-
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). Note that installing ecCodes in conda is different from installing from PyPi via the 'pip' command - see here for more information.
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
-
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: -
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 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.
-
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.
-
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
-
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).