...
Excerpt | ||
---|---|---|
| ||
The key stepUnits is a transient key and it is not written in the grib GRIB message. So, you cannot expect to get the same stepUnits as when you have encoded the data. By convention, when encoding, ecCodes will choose the best unit to encode the step in so that it fits the space available in the grib message. When decoding, ecCodes will return the step in hours by default. |
The key stepUnits is a transient key and it is not written in the grib GRIB message. So, you cannot expect to get the same stepUnits as when you have encoded the data. By convention, when encoding, ecCodes will choose the best unit to encode the step in so that it fits the space available in the grib GRIB message. When decoding, ecCodes will return the step in hours by default.
Note |
---|
Note: The "step" key (as well as startStep, endStep and stepRange) were added purely for the MARS system here at ECMWF and MARS only deals with steps in units of hours. |
The stepUnits key can only be set in the following situations:
- before encoding, in order to tell ecCodes what units are we dealing with
- when decoding, in order to tell ecCodes what units to get the step in
Examples:
Code Block | ||
---|---|---|
| ||
# grib_ls and grib_get will return the step in hours by default (stepUnits=h) % grib_set -s step=3600 file.grib out.grib % grib_get -p startStep,endStep,stepRange,stepUnits:s,stepType out.grib 3600 3600 3600 h instant % grib_set -s stepUnits=m,step=3600 file.grib out.grib % grib_get -p startStep,endStep,stepRange,stepUnits:s,stepType out.grib 60 60 60 h instant # To get the step in the units we want, one could use grib_filter like this: % cat step.filter set stepUnits="m"; print "[startStep] [endStep] [stepRange] [stepUnits:s] [stepType]"; % grib_filter step.filter out.grib 3600 3600 3600 m instant |
One can also set values in a grib GRIB message before printing its contents with tools like grib_ls and grib_get.:
Code Block |
---|
% grib_ls -s stepUnits="m" -p startStep,endStep,stepRange,stepUnits:s,stepType out.grib |
...