ncdata.iris_xarray module#
Interface routines for converting data between Xarray and Iris.
Convert Dataset
s 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. But without actually saving or loading data, of course. There is also support for passing additional keywords to the relevant 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.fileformats.netcdf.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: