Step-by-step guide

Cropping a sub-area from a GRIB field can be done using either the regrid() or read() icons or functions. The area to be cropped to is specified as a list of numbers representing the desired North, South, West, East boundaries. Whichever of the two functions or icons is used, their other functionalities such as filtering or interpolation can also be used in conjunction with the cropping. A simple Python example follows:


import metview as mv

grib_data = mv.read("/path/to/grib/file")

# select an area [N,W,S,E]
data_area = [70, -25, 28, 45]
data_on_subarea = mv.read(data=grib_data, area=data_area)

# data_on_subarea is a Fieldset that can be used like any other, including writing to disk as a GRIB file:
data_on_subarea.write("subarea.grib")

See also this notebook for further information on ways to splice GRIB data: https://metview.readthedocs.io/en/latest/examples/slicing_grib_data.html.