ufs2arco.utils.convert_anemoi_inference_dataset

ufs2arco.utils.convert_anemoi_inference_dataset#

ufs2arco.utils.convert_anemoi_inference_dataset(xds: Dataset)#

Convert the output from anemoi-inference to a multivariate xarray dataset.

Stack each variable separated by vertical level to a single variable with a level dimension

Note that this also renames dimension names “values” -> “cell” so that it is consistent with the anemoi dataset naming convention, and to avoid issues with xarray.DataArray.values.

Example

>>> import xarray as xr
>>> from ufs2arco.utils import convert_anemoi_inference_dataset
>>> ids = xr.open_dataset("/path/to/anemoi_inference.nc", decode_timedelta=True, chunks="auto")
>>> convert_anemoi_inference_dataset(ids)
Parameters:

xds (xr.Dataset) – result from anemoi inference run, stored as netcdf

Returns:

result (xr.Dataset) – with vertical levels stacked and “values” renamed to “cell”