You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

How do I know if I am dealing with a multi-field GRIB file?

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.

  1. For example:

    % 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
  2. 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:

    % 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


    The use of the multi-field feature is not recommended.


There is no content with the specified labels



  • No labels