ls

ls(fs, extra_keys=[], filter={}, no_print=False)
Fieldset.ls(extra_keys=[], filter={}, no_print=False)

New in metview-python version 1.8.0.

Lists the messages of a Fieldset by printing the values of some ecCodes keys.

Parameters
  • fs (Fieldset) – input fieldset

  • extra_keys (list of str) – list of additional ecCodes keys. Type qualifiers (s=string, l=long, d=double) can be appended to each key name following the “:” character. E.g. to get “centre” as long use “centre:l”.

  • filter (dict) – defines a filter to list only a subset of the messages. A filter is a set of ecCodes keys each with a matching value or list of values. These individual conditions are combined together with a logical AND to define the filter (just like in select()).

  • no_print (boolean) – optionally suppress printing to standard output when not in a Jupyter notebook

Return type

Pandas dataframe. If not in a Jupyter notebook the dataframe is printed to the standard output

ls() scans the Fieldset and for each message extracts values for a default set of ecCodes keys. Additional keys can be listed with extra_keys while filter defines the conditions to list only a subset of the messages.

The following example shows how the output looks in a notebook using the default set of ecCodes keys:

import metview as mv
f = mv.read("tuv_pl.grib")
f.ls()
../../_images/ls_1.png

We can add additional keys by using extra_keys:

f.ls(extra_keys=["edition", "paramId:s", "mars.param"])
../../_images/ls_2.png

To list only the fields on 850 hPa we can use filter in the following way:

f.ls(filter={"level": 850})
../../_images/ls_3.png