Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/guide/sources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://cds.climate.copernicus.eu/>`_ data stored on `WEkEO`_ using the `cdsapi`_ grammar
* - :ref:`data-sources-zarr`
- load data from a `Zarr <https://zarr.readthedocs.io/en/stable/>`_ store

----------------------------------

Expand Down Expand Up @@ -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 <https://zarr.readthedocs.io/en/stable/>`_ 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
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/targets/to_target.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://zarr.dev>`_ store.
The ``zarr`` target writes to a `Zarr <https://zarr.readthedocs.io/en/stable/>`_ 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 <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 <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:

Expand Down
8 changes: 5 additions & 3 deletions docs/release_notes/version_0.15_updates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand All @@ -55,6 +55,8 @@ New Xarray engine notebooks
New features
+++++++++++++++++

- Added :ref:`zarr <data-sources-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`)

Expand Down
2 changes: 1 addition & 1 deletion src/earthkit/data/readers/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/sources/test_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading