You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start by importing Xarray - note that we don't need to import Cubed or `cubed-xarray`, since they will be picked up automatically.
19
+
20
+
```{code-cell} ipython3
21
+
import xarray as xr
22
+
23
+
xr.set_options(display_expand_attrs=False);
24
+
```
25
+
26
+
We open an Xarray dataset (in netCDF format) using the usual `open_dataset` function. By specifying `chunks={}` we ensure that the dataset is chunked using the on-disk chunking (here it is the netCDF file chunking). The `chunked_array_type` argument specifies which chunked array type to use - Cubed in this case.
Looking at the `air` data variable again, we can see that it is now chunked along the time dimension.
49
+
50
+
```{code-cell} ipython3
51
+
rds["air"]
52
+
```
53
+
54
+
## Save to Zarr
55
+
56
+
Since Cubed has a lazy computation model, the data has not been loaded from disk yet. We can save a copy of the rechunked dataset by calling `to_zarr`:
This will run a computation that loads the input data and writes it out to a Zarr store on the local filesystem with the new chunking. We can check that it worked by re-loading from disk using `xarray.open_dataset` and checking that the chunks are the same:
0 commit comments