diff --git a/docs/guide/sources.rst b/docs/guide/sources.rst index 6599d892d..d9d4f10b2 100644 --- a/docs/guide/sources.rst +++ b/docs/guide/sources.rst @@ -66,6 +66,8 @@ We can get data from a given source by using :func:`from_source`: - retrieve data from `WEkEO`_ using the WEkEO grammar * - :ref:`data-sources-wekeocds` - retrieve `CDS `_ data stored on `WEkEO`_ using the `cdsapi`_ grammar + * - :ref:`data-sources-zarr` + - load data from a `Zarr `_ store ---------------------------------- @@ -1229,6 +1231,22 @@ wekeocds - :ref:`/examples/wekeo.ipynb` + +.. _data-sources-zarr: + +zarr +-------- + +.. py:function:: from_source("zarr", path) + :noindex: + + The ``zarr`` source accesses data from a `Zarr `_ store. Internally the data is loaded via the :py:meth:`xarray.open_zarr` method. So only Zarr data supported by Xarray can be accessed. + + :param str path: path or URL to the Zarr store + + + + .. _MARS catalog: https://apps.ecmwf.int/archive-catalogue/ .. _MARS user documentation: https://confluence.ecmwf.int/display/UDOC/MARS+user+documentation .. _web API: https://www.ecmwf.int/en/forecasts/access-forecasts/ecmwf-web-api diff --git a/docs/guide/targets/to_target.rst b/docs/guide/targets/to_target.rst index 8c943527f..1a4de625f 100644 --- a/docs/guide/targets/to_target.rst +++ b/docs/guide/targets/to_target.rst @@ -182,13 +182,13 @@ zarr .. py:function:: to_target("zarr", earthkit_to_xarray_kwargs=None, xarray_to_zarr_kwargs=None, data=None) :noindex: - The ``zarr`` target writes to a `zarr `_ store. + The ``zarr`` target writes to a `Zarr `_ store. :param dict earthkit_to_xarray_kwargs: the keyword arguments passed to the :func:`to_xarray` function. If not provided, the default values are used. :param dict xarray_to_zarr_kwargs: the keyword arguments passed to the :py:func:`xarray.Dataset.to_zarr` function. As a bare minimum, the ``store`` keyword argument must be provided. :param data: specify the data to write. Cannot be set when :func:`to_target` is called on a data object. - This target converts the data to an :ref:`xarray.Dataset ` and then writes it to a zarr store using the :py:func:`xarray.Dataset.to_zarr` function. The conversion to an xarray dataset is done by the :func:`to_xarray` function. + This target converts the data to an :ref:`xarray.Dataset ` and then writes it to a Zarr store using the :py:func:`xarray.Dataset.to_zarr` function. The conversion to an Xarray dataset is done by the :func:`to_xarray` function. Notebook examples: diff --git a/docs/release_notes/version_0.15_updates.rst b/docs/release_notes/version_0.15_updates.rst index f53d1e020..bb09ffd41 100644 --- a/docs/release_notes/version_0.15_updates.rst +++ b/docs/release_notes/version_0.15_updates.rst @@ -44,9 +44,9 @@ Other changes New Xarray engine notebooks ------------------------------ -- :ref:`/examples/xr_engine_step_range.ipynb` -- :ref:`/examples/xr_engine_ensemble.ipynb` -- :ref:`/examples/xr_engine_squeeze.ipynb` +- :ref:`/examples/xarray_engine_step_ranges.ipynb` +- :ref:`/examples/xarray_engine_ensemble.ipynb` +- :ref:`/examples/xarray_engine_squeeze.ipynb` - :ref:`/examples/xarray_engine_chunks.ipynb` - :ref:`/examples/list_of_dicts_to_xarray.ipynb` @@ -55,6 +55,8 @@ New Xarray engine notebooks New features +++++++++++++++++ +- Added :ref:`zarr ` source to read Zarr data (:pr:`675`). +- Added the :ref:`targets-zarr` target (:pr:`716`). See the :ref:`/examples/grib_to_zarr_target.ipynb` notebook example. - Added new config option ``grib-file-serialisation-policy`` to control how GRIB data on disk is pickled. The options are "path" and "memory". The default is "path". Previously, only "memory" was implemented (:pr:`700`). - Added serialisation to GRIB fields (both on disk and in-memory) (:pr:`700`) diff --git a/src/earthkit/data/readers/directory.py b/src/earthkit/data/readers/directory.py index a15af57be..c5d72c425 100644 --- a/src/earthkit/data/readers/directory.py +++ b/src/earthkit/data/readers/directory.py @@ -69,7 +69,7 @@ def mutate_source(self): ): if self.stream: raise ValueError("Cannot stream zarr directories") - return from_source("xarray-zarr", self.path) + return from_source("zarr", self.path) if len(self._content) == 1: return from_source( diff --git a/src/earthkit/data/sources/xarray_zarr.py b/src/earthkit/data/sources/zarr.py similarity index 100% rename from src/earthkit/data/sources/xarray_zarr.py rename to src/earthkit/data/sources/zarr.py diff --git a/tests/sources/test_zarr.py b/tests/sources/test_zarr.py index 109cf2d82..4348e972c 100644 --- a/tests/sources/test_zarr.py +++ b/tests/sources/test_zarr.py @@ -19,7 +19,7 @@ @pytest.mark.skipif(NO_ZARR, reason="Zarr not installed") def test_zarr_source(): - ds = from_source("xarray-zarr", earthkit_test_data_file("test_zarr/")) + ds = from_source("zarr", earthkit_test_data_file("test_zarr/")) assert len(ds) == 4 assert isinstance(ds[0], XArrayField) assert isinstance(ds[1], XArrayField)