Whenever -set_metadata option is "executed", one
line of the data file is read, the metadata is then applied to the current
(sub-)message. For example, your grib file has 3 messages and you
want to alter the metadata. Here is a metadata file
that could be used to alter the grib file.
0:0:d=2009010100:TMP:2 m above ground:anl
0:0:d=2009010106:HGT:500 mb:12 hour forecast:scale=0,0
The format of the metadata file resembles the wgrib2 inventory by design.
The first and second fields are ignored by by -set_metadata.
In practice, the first first is the record number and the second field
is the byte location of the template to be used. (A template file
could be a collection of templates.) The third through sixth fields
are the date code, variable name, level and ftime. Finally the remaining
fields are optional and order independent.
scale=I,J set decimal scaling (I) and binary scaling (J)
packing=S set compression/packing to S
S=simple,complex1,complex2,complex3,jpeg (long form)
S=s,c1,c2,c3,j (short form)
N%d level set percentile
prob ... set probability
ENS=... set ensemble member info
N ens members set number of ensemble members
code table X.Y=Z set code table, equivalent -set table_X.Y Z requires wgrib2 v2.0.5+
flag table X.Y=Z set flag table, equivalent -set table_X.Y Z requires wgrib2 v2.0.5+
note: not X.Y have been implemented
Following options follows -set VAR VAL and do not follow the wgrib2 inventory format
center= set center
subcenter= set sub-center
table_M.N= only for selected M.N
To change the metadata, you can do
wgrib2 in.grb -set_metadata meta -grib_out out.grb
The -set_metadata option is used for creating
grib2 files. Note that both
-set_metadata and the various
-import options will change the output
precision. Consequently the
-import option should preceed the
Note: only a subset of levels and ftime parameters is currently implemented.
The -set_metadatda option
does not support all metadata.
To format of the levels and ftime are
the same was used by wgrib2 inventories.