@@ -13,6 +13,8 @@ format (recommended).
1313
1414 import os
1515
16+ import iris
17+ import ncdata.iris_xarray
1618 import numpy as np
1719 import pandas as pd
1820 import xarray as xr
@@ -1072,8 +1074,11 @@ Iris
10721074
10731075The Iris _ tool allows easy reading of common meteorological and climate model formats
10741076(including GRIB and UK MetOffice PP files) into ``Cube `` objects which are in many ways very
1075- similar to ``DataArray `` objects, while enforcing a CF-compliant data model. If iris is
1076- installed, xarray can convert a ``DataArray `` into a ``Cube `` using
1077+ similar to ``DataArray `` objects, while enforcing a CF-compliant data model.
1078+
1079+ DataArray ``to_iris `` and ``from_iris ``
1080+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1081+ If iris is installed, xarray can convert a ``DataArray `` into a ``Cube `` using
10771082:py:meth: `DataArray.to_iris `:
10781083
10791084.. ipython :: python
@@ -1095,9 +1100,36 @@ Conversely, we can create a new ``DataArray`` object from a ``Cube`` using
10951100 da_cube = xr.DataArray.from_iris(cube)
10961101 da_cube
10971102
1103+ Ncdata
1104+ ~~~~~~
1105+ Ncdata _ provides more sophisticated means of transferring data, including entire
1106+ datasets. It uses the file saving and loading functions in both projects to provide a
1107+ more "correct" translation between them, but still with very low overhead and not
1108+ using actual disk files.
10981109
1099- .. _Iris : https://scitools.org.uk/iris
1110+ For example:
1111+
1112+ .. ipython :: python
1113+ :okwarning:
11001114
1115+ ds = xr.tutorial.open_dataset(" air_temperature_gradient" )
1116+ cubes = ncdata.iris_xarray.cubes_from_xarray(ds)
1117+ print (cubes)
1118+ print (cubes[1 ])
1119+
1120+ .. ipython :: python
1121+ :okwarning:
1122+
1123+ ds = ncdata.iris_xarray.cubes_to_xarray(cubes)
1124+ print (ds)
1125+
1126+ Ncdata can also adjust file data within load and save operations, to fix data loading
1127+ problems or provide exact save formatting without needing to modify files on disk.
1128+ See for example : `ncdata usage examples `_
1129+
1130+ .. _Iris : https://scitools.org.uk/iris
1131+ .. _Ncdata : https://ncdata.readthedocs.io/en/latest/index.html
1132+ .. _ncdata usage examples : https://github.com/pp-mo/ncdata/tree/v0.1.2?tab=readme-ov-file#correct-a-miscoded-attribute-in-iris-input
11011133
11021134OPeNDAP
11031135-------
0 commit comments