@@ -13,6 +13,8 @@ format (recommended).
13
13
14
14
import os
15
15
16
+ import iris
17
+ import ncdata.iris_xarray
16
18
import numpy as np
17
19
import pandas as pd
18
20
import xarray as xr
@@ -1072,8 +1074,11 @@ Iris
1072
1074
1073
1075
The Iris _ tool allows easy reading of common meteorological and climate model formats
1074
1076
(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
1077
1082
:py:meth: `DataArray.to_iris `:
1078
1083
1079
1084
.. ipython :: python
@@ -1095,9 +1100,36 @@ Conversely, we can create a new ``DataArray`` object from a ``Cube`` using
1095
1100
da_cube = xr.DataArray.from_iris(cube)
1096
1101
da_cube
1097
1102
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.
1098
1109
1099
- .. _Iris : https://scitools.org.uk/iris
1110
+ For example:
1111
+
1112
+ .. ipython :: python
1113
+ :okwarning:
1100
1114
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
1101
1133
1102
1134
OPeNDAP
1103
1135
-------
0 commit comments