DESCRIPTION
List content of
...
GRIB files printing values of some keys.
...
It does not fail when a key is not found.
USAGE
grib_ls [options] grib_file grib_file ...
OPTIONS
-p key[:{s
...
|d
...
|i}],key[:{s
...
|d
...
|i}],...
Declaration of keys to print.
...
For each key a string (key:s)
...
, a double (key:d) or
...
an integer (key:
...
i)
...
type can be requested. Default type is string.
-F format
C style format for floating-point values.
-P key[:{s
...
|d
...
|i}],key[:{s
...
|d
...
|i}],...
As -p adding the declared keys to the default list.
-w key[:{s
...
|d
...
|i}]{=
...
|!=}value,key[:{s
...
|d
...
|i}]{=
...
|!=}value,...
Where clause.
...
Messages are processed only if they match all the key/value constraints.
...
A valid constraint is of type key=value or key!=value.
...
For each key a string (key:s)
...
, a double (key:d) or
...
an integer (key:
...
i)
...
type can be specified.
Default type is string.
In the value you can also use the forward-slash character '/' to specify an OR condition (i.e. a logical disjunction)
Note: only one -
...
w clause is allowed.
-j
JSON output
-B order by directive
Order by. The output will be ordered according to the 'order by' directive.
...
Example: "step:i asc, centre desc" (step numeric ascending and centre descending)
Default sort mode is 'asc'
-l
...
latitude,
...
longitude[,MODE,file]
Value close to the point of a
...
latitude/longitude (nearest neighbour).
Allowed values for MODE are:
4 (4 values in the nearest points are printed) Default
1 (the value at the nearest point is printed)
file (file is used as mask. The closer point with mask value>=0.5 is printed)
-s key[:{s
...
|d
...
|i}]=value,key[:{s
...
|d
...
|i}]=value,...
Key/values to set.
...
For each key a string (key:s)
...
, a double (key:d) or
...
an integer (key:
...
i)
...
type can be defined. By default the native type is set.
-i index
Data value corresponding to the given index is printed.
-n namespace
All the keys belonging to namespace are printed.
-m
Mars keys are printed.
-V
Version.
-W width
Minimum width of each column in output. Default is 10.
-M
Multi-field support off. Turn off support for multiple fields in
...
a single GRIB message.
-g
Copy GTS header.
-T T | B | M | A
Message type. T->GTS, B->BUFR, M->METAR (Experimental),A->Any (Experimental). The input file is interpreted according to the message type.
-7
Does not fail when the message has wrong length
-X offset
Input file offset in bytes. Processing of the input file will start from "offset".
-x
Fast parsing option, only headers are loaded.
grib_ls examples
Without options a default list of keys is printed. The default list is different depending on the type of grib message.
Code Block > grib_ls ../data/reduced*.grib1 ../data/regular*.grib1 ../data/reduced*.grib2
To print offset and count number in file use the keys offset and count Also the total count in a set of files is available as countTotal
Code Block > grib_ls -p offset,count,countTotal ../data/reduced*.grib1
To list only a subset of messages use the -w (where option). Only the pressure levels are listed with the following line.
Code Block > grib_ls -w levelType=pl ../tigge_pf_ecmwf.grib2
All the grib messages not on pressure levels are listed as follows:
Code Block > grib_ls -w levelType!=pl ../tigge_pf_ecmwf.grib2
To get the closest grid point to a latitude/longitude.
Code Block > grib_ls -l 51.46,-1.33,1 -p paramId,name ../data/reduced_gaussian_surface.grib2 ../data/reduced_gaussian_surface.grib2 paramId shortName value 167 2t 282.002 1 of 1 messages in ../data/reduced_gaussian_surface.grib2 1 of 1 total messages in 1 files Input Point: latitude=51.46 longitude=-1.33 Grid Point chosen #3 index=749 latitude=51.63 longitude=0.00 distance=93.81 (Km) Other grid Points 1 - index=845 latitude=48.84 longitude=0.00 distance=306.86 (Km) 2 - index=944 latitude=48.84 longitude=356.40 distance=333.66 (Km) 3 - index=749 latitude=51.63 longitude=0.00 distance=93.81 (Km) 4 - index=844 latitude=51.63 longitude=356.25 distance=168.37 (Km)
To get a list ordered by the 'level' key (ascending order).
Code Block > grib_ls -B 'level:i asc' tigge_af_ecmwf.grib2
Note: we need to specify the ':i' to get a numerical sort. By default values are sorted as strings so a level of 100 would come before 20!