dataset_to_fieldset

dataset_to_fieldset(xds)

Converts an xarray Dataset to a Fieldset.

Parameters

xds (xarray.Dataset) – the xarray Dataset

Return type

Fieldset

The conversion is based on the Open Source cfgrib package which is an xarray backend engine. Note that this uses an experimental feature of cfgrib and will only work for a small subset of xarray datasets.

Example
import metview as mv

grib = mv.read('temperature_on_pl.grib')
x = grib.to_dataset() # convert from Fieldset to dataset
f = mv.dataset_to_fieldset(x) # convert back to Fieldset