Versions Compared

Key

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

...

  1. To set productDefinitionTemplateNumber=2 only for the fields with productDefinitionTemplateNumber=11 \n

    Code Block
    >>grib_set -s productDefinitionTemplateNumber=2 -w productDefinitionTemplateNumber=11 ../data/tigge_pf_ecmwf.grib2 out.grib2
  2. To set productDefinitionTemplateNumber=2 only for the fields for which productDefinitionTemplateNumber is not equal to 11 \n

    Code Block
    >>grib_set -s productDefinitionTemplateNumber=2 -w productDefinitionTemplateNumber!=11 tigge_pf_ecmwf.grib2 out.grib2
  3. When a key is not used all the bits of its value should be set to 1 to indicate that it is missing. Since the length (number of octet) is different from a key to another, the value that we have to code for missing keys is not unique. To give an easy way to set a key to missing a string "missing" or "MISSING" is accepted by grib_set as follows:\n

    Code Block
    >>grib_set -s scaleFactorOfFirstFixedSurface=missing,scaledValueOfFirstFixedSurface=MISSING ../data/regular_latlon_surface.grib2 out.grib2
  4. To set scaleFactorOfSecondFixedSurface to missing only for the fields for which scaleFactorOfSecondFixedSurface is not missing: \n

    Code Block
    >>grib_set -s scaleFactorOfSecondFixedSurface=missing -w scaleFactorOfSecondFixedSurface!=missing tigge_pf_ecmwf.grib2 out.grib2
  5. It's possible to produce a grib edition 2 file from a grib edition 1 just changing the edition number with grib_set.At this stage of development all the geography parameters, level and time information is correctly translated, for the productdefinition extra set calls must be done. To do this properly, \ref grib_filter is suggested. \n

    Code Block
    >grib_set -s edition=2 ../data/reduced_gaussian_pressure_level.grib1
  6. With grib edition 2 is possible to compress data using the jpeg algorithm. To change packing algorithm from grid_simple (simple packing) to grid_jpeg (jpeg2000 packing):\n

    Code Block
    >>grib_set -s packingType=grid_jpeg ../data/regular_gaussian_model_level.grib2 out.grib2
  7. It's possible to ask grib_api to calculate the number of bits per value needed to pack a givenfield with a fixed number of decimal digits of precision. For example if we want to pack a temperatureexpressed in Kelvin with 1 digits of precision after the decimal point we can set changeDecimalPrecision=1 \n

    Code Block
    >>grib_set -s changeDecimalPrecision=1 ../data/regular_latlon_surface.grib2 ../data/out.grib2rm -f ../data/out.grib2 | true./grib_set -s changeDecimalPrecision=1 ../data/regular_latlon_surface.grib2 ../data/out.grib2