Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You are trying to convert a GRIB edition 1 field to GRIB edition 2 via grib_set but it fails.

Solution

Let's say you have a GRIB1 file with the paramId=201 which is "Maximum temperature at 2 metres since previous post-processing". You try to convert it to edition 2:

Code Block
% grib_ls -p paramId,shortName mx2t.grib1
paramId     shortName
201         mx2t

% grib_set -s edition=2 mx2t.grib1 mx2t.grib2
ECCODES ERROR: grib_set_values[4] typeOfStatisticalProcessing (type=long) failed: Key/value not found
ECCODES ERROR: grib_set_values[0] edition (type=long) failed: Key/value not found

This is The conversion fails because the definition of the parameter 201 contains the key "typeOfStatisticalProcessing". Check the GRIB2 representation of this parameter in the Parameter database..
A value of 2 means "Maximum", see code table for key "typeOfStatisticalProcessing".

The grib_set command above sets the Product Definition Template number to 0 (instantaneous) because that is the default.

But this parameter requires a Product Definition Template for interval-based products (not instantaneous), see here.

So we need to select the correct Product Definition Template number:

#fff
Code Block
% grib_set -s edition=2,productDefinitionTemplateNumber=8 mx2t.grib1 mx2t.grib2
% grib_ls -p paramId,shortName mx2t.grib2
paramId     shortName
201         mx2t
Panel
bgColor


Content by Label
showLabelsfalse
max5
spacesUDOC
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("grib","grib_set") and label = "grib" and label = "grib_set" and type = "page" and space = "UDOC"
labelsgrib grib_set

...