@@ -44,9 +44,9 @@ __ https://www.unidata.ucar.edu/software/netcdf/
44
44
45
45
.. _netCDF FAQ : https://www.unidata.ucar.edu/software/netcdf/docs/faq.html#What-Is-netCDF
46
46
47
- Reading and writing netCDF files with xarray requires scipy or the
48
- `netCDF4-Python `__ library to be installed (the latter is required to
49
- read/write netCDF V4 files and use the compression options described below) .
47
+ Reading and writing netCDF files with xarray requires scipy, h5netcdf, or the
48
+ `netCDF4-Python `__ library to be installed. SciPy only supports reading and writing
49
+ of netCDF V3 files.
50
50
51
51
__ https://github.com/Unidata/netcdf4-python
52
52
@@ -675,8 +675,8 @@ the same as the one that was saved.
675
675
676
676
.. note ::
677
677
678
- xarray does not write NCZarr attributes. Therefore, NCZarr data must be
679
- opened in read-only mode.
678
+ xarray does not write ` NCZarr < https://docs.unidata.ucar.edu/nug/current/nczarr_head.html >`_ attributes.
679
+ Therefore, NCZarr data must be opened in read-only mode.
680
680
681
681
To store variable length strings, convert them to object arrays first with
682
682
``dtype=object ``.
@@ -696,10 +696,10 @@ It is possible to read and write xarray datasets directly from / to cloud
696
696
storage buckets using zarr. This example uses the `gcsfs `_ package to provide
697
697
an interface to `Google Cloud Storage `_.
698
698
699
- From v0.16.2: general `fsspec `_ URLs are parsed and the store set up for you
700
- automatically when reading, such that you can open a dataset in a single
701
- call. You should include any arguments to the storage backend as the
702
- key ``storage_options ``, part of ``backend_kwargs ``.
699
+ General `fsspec `_ URLs, those that begin with `` s3:// `` or `` gcs:// `` for example,
700
+ are parsed and the store set up for you automatically when reading.
701
+ You should include any arguments to the storage backend as the
702
+ key ``` storage_options ``, part of ``backend_kwargs ``.
703
703
704
704
.. code :: python
705
705
@@ -715,7 +715,7 @@ key ``storage_options``, part of ``backend_kwargs``.
715
715
This also works with ``open_mfdataset ``, allowing you to pass a list of paths or
716
716
a URL to be interpreted as a glob string.
717
717
718
- For older versions, and for writing, you must explicitly set up a ``MutableMapping ``
718
+ For writing, you must explicitly set up a ``MutableMapping ``
719
719
instance and pass this, as follows:
720
720
721
721
.. code :: python
@@ -769,10 +769,10 @@ Consolidated Metadata
769
769
~~~~~~~~~~~~~~~~~~~~~
770
770
771
771
Xarray needs to read all of the zarr metadata when it opens a dataset.
772
- In some storage mediums, such as with cloud object storage (e.g. amazon S3),
772
+ In some storage mediums, such as with cloud object storage (e.g. ` Amazon S3`_ ),
773
773
this can introduce significant overhead, because two separate HTTP calls to the
774
774
object store must be made for each variable in the dataset.
775
- As of xarray version 0.18, xarray by default uses a feature called
775
+ By default Xarray uses a feature called
776
776
*consolidated metadata *, storing all metadata for the entire dataset with a
777
777
single key (by default called ``.zmetadata ``). This typically drastically speeds
778
778
up opening the store. (For more information on this feature, consult the
@@ -796,16 +796,20 @@ reads. Because this fall-back option is so much slower, xarray issues a
796
796
797
797
.. _io.zarr.appending :
798
798
799
- Appending to existing Zarr stores
800
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
799
+ Modifying existing Zarr stores
800
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
801
801
802
802
Xarray supports several ways of incrementally writing variables to a Zarr
803
803
store. These options are useful for scenarios when it is infeasible or
804
804
undesirable to write your entire dataset at once.
805
805
806
+ 1. Use ``mode='a' `` to add or overwrite entire variables,
807
+ 2. Use ``append_dim `` to resize and append to exiting variables, and
808
+ 3. Use ``region `` to write to limited regions of existing arrays.
809
+
806
810
.. tip ::
807
811
808
- If you can load all of your data into a single ``Dataset `` using dask, a
812
+ For ``Dataset `` objects containing dask arrays , a
809
813
single call to ``to_zarr() `` will write all of your data in parallel.
810
814
811
815
.. warning ::
@@ -876,8 +880,8 @@ and then calling ``to_zarr`` with ``compute=False`` to write only metadata
876
880
ds.to_zarr(path, compute = False )
877
881
878
882
Now, a Zarr store with the correct variable shapes and attributes exists that
879
- can be filled out by subsequent calls to ``to_zarr ``. `` region `` can be
880
- specified as `` "auto" ``, which opens the existing store and determines the
883
+ can be filled out by subsequent calls to ``to_zarr ``.
884
+ Setting `` region= "auto" `` will open the existing store and determine the
881
885
correct alignment of the new data with the existing coordinates, or as an
882
886
explicit mapping from dimension names to Python ``slice `` objects indicating
883
887
where the data should be written (in index space, not label space), e.g.,
0 commit comments