grib_api: grib_ls

- Main Page
- Modules
- Files
- Related Pages
- Examples

# grib_ls

## 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/l}],key[:{s/d/l}],...
Declaration of keys to print. For each key a string (key:s) or a double (key:d) or a long (key:l) type can be requested. Default type is string.
-F format
C style format for floating point values.
-P key[:{s/d/l}],key[:{s/d/l}],...
As -p adding the declared keys to the default list.
-w key[:{s/d/l}]{=/!=}value,key[:{s/d/l}]{=/!=}value,...
Where clause. Grib 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) or a double (key:d) or a long (key:l) type can be specified. Default type is string.
-B order by directive
Order by. The output will be ordered according the order by directive. Order by example: "step asc, centre desc" (step ascending and centre discending)
-l Latitude,Longitude[,MODE,file]
Value close to the point of a Latitude/Longitude. 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)
-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-grib support off. Turn off support for multiple fields in single grib message
-g
Copy GTS header.
-G
GRIBEX compatibility mode.
-7
Does not fail when the message has wrong length

## grib_ls examples

1. Without options a default list of keys is printed.
   The default list is different depending on the type of grib message.

       > grib_ls ../data/reduced*.grib1 ../data/regular*.grib1 ../data/reduced*.grib2 \n

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

       > grib_ls -p offset,count,countTotal ../data/reduced*.grib1

3. To list only a subset of messages use the -w (where option).
   Only the pressure levels are listed with the following line.

       > grib_ls -w levType=pl ../tigge_pf_ecmwf.grib2

4. All the grib messages not on pressure levels are listed as follows:

       > grib_ls -w levType!=pl ../tigge_pf_ecmwf.grib2