Excerpt |
---|
|
At the moment, the only possible way of detecting if a GRIB file is multi-field is by using the grib tools or the API to turn the support for multiple fields in a single GRIB message on or off and observe the results |
Step-by-step guide
At the moment, the only possible way of detecting if a GRIB file is multi-field is by using the grib tools or the API to turn the support for multiple fields in a single GRIB message on or off and observe the results. For example you can do a "grib_count" and compare the result with "grib_ls", in a multi-field GRIB file the latter will report more messages than the former.
For example:
Code Block |
---|
% grib_count my.grib2
30
% grib_ls my.grib2
edition centre date dataType gridType stepRange typeOfLevel level shortName packingType
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 100 clwmr grid_jpeg
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 500 5wavh grid_jpeg
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 1000 u grid_jpeg
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 1000 v grid_jpeg
...
56 of 56 messages in my.grib2 |
Here we have a file with 30 messages (result of grib_count) but grib_ls reports 56 because by default the grib tools 'expand' the messages i.e. convert the multi-field messages to single-field ones before printing. This feature can be turned off by specifying the "-M" option:
Code Block |
---|
% grib_ls -M my.grib2
edition centre date dataType gridType stepRange typeOfLevel level shortName packingType
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 100 clwmr grid_jpeg
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 500 5wavh grid_jpeg
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 1000 u grid_jpeg
2 kwbc 20061128 fc regular_ll 6 isobaricInhPa 975 u grid_jpeg
...
30 of 30 messages in my.grib2 |
Warning |
---|
The use of the multi-field feature is not recommended. |
Related articles
Content by Label |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | ~usa |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label in ("kb-how-to-article","eccodes-faqs","grib","grib_count","multi-field") and type = "page" and space = "UDOC" |
---|
labels | kb-how-to-article |
---|
|