1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
Description: Remove references that break because iris module, etc not installed
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2025-12-05
Forwarded: not-needed
--- a/doc/user-guide/io.rst
+++ b/doc/user-guide/io.rst
@@ -13,8 +13,6 @@
import os
- import iris
- import ncdata.iris_xarray
import numpy as np
import pandas as pd
import xarray as xr
@@ -1304,13 +1302,13 @@
.. jupyter-execute::
- ds_kerchunked = xr.open_dataset(
- "./combined.json",
- engine="kerchunk",
- storage_options={},
- )
+ #ds_kerchunked = xr.open_dataset(
+ # "./combined.json",
+ # engine="kerchunk",
+ # storage_options={},
+ #)
- ds_kerchunked
+ #ds_kerchunked
.. note::
@@ -1334,22 +1332,22 @@
.. jupyter-execute::
- da = xr.DataArray(
- np.random.rand(4, 5),
- dims=["x", "y"],
- coords=dict(x=[10, 20, 30, 40], y=pd.date_range("2000-01-01", periods=5)),
- )
+ #da = xr.DataArray(
+ # np.random.rand(4, 5),
+ # dims=["x", "y"],
+ # coords=dict(x=[10, 20, 30, 40], y=pd.date_range("2000-01-01", periods=5)),
+ #)
- cube = da.to_iris()
- print(cube)
+ #cube = da.to_iris()
+ #print(cube)
Conversely, we can create a new ``DataArray`` object from a ``Cube`` using
:py:meth:`DataArray.from_iris`:
.. jupyter-execute::
- da_cube = xr.DataArray.from_iris(cube)
- da_cube
+ #da_cube = xr.DataArray.from_iris(cube)
+ #da_cube
Ncdata
~~~~~~
@@ -1363,23 +1361,23 @@
.. jupyter-execute::
:stderr:
- ds = xr.tutorial.open_dataset("air_temperature_gradient")
- cubes = ncdata.iris_xarray.cubes_from_xarray(ds)
- print(cubes)
+ #ds = xr.tutorial.open_dataset("air_temperature_gradient")
+ #cubes = ncdata.iris_xarray.cubes_from_xarray(ds)
+ #print(cubes)
.. jupyter-execute::
- print(cubes[1])
+ #print(cubes[1])
And we can convert the cubes back to an xarray dataset:
.. jupyter-execute::
# ensure dataset-level and variable-level attributes loaded correctly
- iris.FUTURE.save_split_attrs = True
+ #iris.FUTURE.save_split_attrs = True
- ds = ncdata.iris_xarray.cubes_to_xarray(cubes)
- ds
+ #ds = ncdata.iris_xarray.cubes_to_xarray(cubes)
+ #ds
Ncdata can also adjust file data within load and save operations, to fix data loading
problems or provide exact save formatting without needing to modify files on disk.
|