ncdata.iris_xarray module#
Interface routines for converting data between Xarray and Iris.
Convert Dataset
to and from Iris Cube
\s.
By design, these transformations should be equivalent to saving data from one package to a netcdf file, and re-loading into the other package. There is also support for passing additional keywords to the appropriate load/save routines.
- ncdata.iris_xarray.cubes_from_xarray(xrds, xr_save_kwargs=None, iris_load_kwargs=None)#
Convert an xarray
xarray.Dataset
to an Irisiris.cube.CubeList
.Equivalent to saving the dataset to a netcdf file, and loading that with Iris.
Netcdf variable data in the output contains the same array objects as the input, i.e. arrays (Dask or Numpy) are not copied or computed.
- Parameters:
xrds (
xarray.Dataset
) – input datasetxr_save_kwargs (dict) – additional keywords passed to
xarray.Dataset.dump_to_store()
iris_load_kwargs (dict) – additional keywords passed to
iris.fileformats.netcdf.load_cubes()
- Returns:
cubes – loaded cubes
- Return type:
- ncdata.iris_xarray.cubes_to_xarray(cubes, iris_save_kwargs=None, xr_load_kwargs=None)#
Convert Iris
iris.cube.Cube
\s to an xarrayxarray.Dataset
.Equivalent to saving the dataset to a netcdf file, and loading that with Xarray.
Netcdf variable data in the output contains the same array objects as the input, i.e. arrays (Dask or Numpy) are not copied or computed.
- Parameters:
cubes (
iris.cube.Cube
, or iterable of Cubes.) – source datairis_save_kwargs (dict) – additional keywords passed to
iris.save()
, and toiris.fileformats.netcdf.saver.save()
xr_load_kwargs (dict) – additional keywords passed to
xarray.Dataset.load_store()
- Returns:
xrds – converted data in the form of an Xarray
xarray.Dataset
- Return type: