diff --git a/docs/install.rst b/docs/install.rst index 92cd8e35..4de7d092 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -47,7 +47,7 @@ Alternatively, you can install the following components: - odb: provides full support for the :ref:`odb` data type - geopandas: adds geojson/geopandas support - projection: adds projection support - - eccovjson: provides access to coverage json data served by the :ref:`data-sources-polytope` source + - covjsonkit: provides access to coverage json data served by the :ref:`data-sources-polytope` source E.g. to add :ref:`data-sources-mars` support you can use: diff --git a/docs/release_notes/version_0.10_updates.rst b/docs/release_notes/version_0.10_updates.rst index cc6dbf89..c91f4e99 100644 --- a/docs/release_notes/version_0.10_updates.rst +++ b/docs/release_notes/version_0.10_updates.rst @@ -2,6 +2,15 @@ Version 0.10 Updates ///////////////////////// +Version 0.10.10 +=============== + +Changes ++++++++ + +- Use ``covjsonkit`` instead of ``ecccovjson`` to read coverage json data retrieved from the :ref:`data-sources-polytope` source (:pr:`445`). + + Version 0.10.9 =============== diff --git a/environment.yml b/environment.yml index 5c8d04ec..227e676b 100644 --- a/environment.yml +++ b/environment.yml @@ -27,7 +27,7 @@ dependencies: - ecmwf-opendata>=0.1.2 - polytope-client>=0.7.4 - earthkit-meteo>=0.0.1 - - eccovjson>=0.0.5 + - covjsonkit>=0.0.25 - earthkit-geo>=0.2.0 - tqdm>=4.63.0 - lru-dict diff --git a/pyproject.toml b/pyproject.toml index 236aea80..f381e78d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ dependencies = [ optional-dependencies.all = [ "cartopy", "cdsapi>=0.7.2", - "eccovjson>=0.0.5", + "covjsonkit>=0.0.25", "ecmwf-api-client>=1.6.1", "ecmwf-opendata>=0.3.3", "geopandas", @@ -69,11 +69,14 @@ optional-dependencies.ci = [ "array-api-compat", "torch", ] +optional-dependencies.covjsonkit = [ + "covjsonkit>=0.0.25", +] optional-dependencies.dev = [ "cartopy", "cdsapi>=0.7.2", + "covjsonkit>=0.0.25", "earthkit-data-demo-source", - "eccovjson>=0.0.5", "ecmwf-api-client>=1.6.1", "ecmwf-opendata>=0.3.3", "geopandas", @@ -88,9 +91,6 @@ optional-dependencies.dev = [ "pytest-forked", "pytest-timeout", ] -optional-dependencies.eccovjson = [ - "eccovjson>=0.0.5", -] optional-dependencies.ecmwf-opendata = [ "ecmwf-opendata>=0.3.3", ] diff --git a/src/earthkit/data/readers/covjson.py b/src/earthkit/data/readers/covjson.py index e91a94bf..578fcbb4 100644 --- a/src/earthkit/data/readers/covjson.py +++ b/src/earthkit/data/readers/covjson.py @@ -16,11 +16,11 @@ class XarrayMixIn: def to_xarray(self, **kwargs): try: - from eccovjson.api import Eccovjson + from covjsonkit.api import Covjsonkit except ImportError: - raise ImportError("covjason handling requires 'eccovjson' to be installed") + raise ImportError("covjason handling requires 'covjsonkit' to be installed") - decoder = Eccovjson().decode(self._json()) + decoder = Covjsonkit().decode(self._json()) return decoder.to_xarray() diff --git a/src/earthkit/data/testing.py b/src/earthkit/data/testing.py index b6aaf999..b49cc57c 100644 --- a/src/earthkit/data/testing.py +++ b/src/earthkit/data/testing.py @@ -114,7 +114,7 @@ def modules_installed(*modules): NO_FDB = True NO_POLYTOPE = not os.path.exists(os.path.expanduser("~/.polytopeapirc")) -NO_ECCOVJSON = not modules_installed("eccovjson") +NO_COVJSONKIT = not modules_installed("covjsonkit") NO_PYTORCH = not modules_installed("torch") NO_CUPY = not modules_installed("cupy") if not NO_CUPY: diff --git a/tests/data/time_series.covjson b/tests/data/time_series.covjson index 2e3648ac..fa1c0004 100644 --- a/tests/data/time_series.covjson +++ b/tests/data/time_series.covjson @@ -1 +1 @@ -{"type": "CoverageCollection", "domainType": "PointSeries", "coverages": [{"mars:metadata": {"class": "od", "date": "20240103T00", "domain": "g", "expver": "0001", "levtype": "sfc", "stream": "oper", "type": "fc", "number": 1}, "type": "Coverage", "domain": {"type": "Domain", "axes": {"x": {"values": [0.035149384216]}, "y": {"values": [0.0]}, "z": {"values": ["sfc"]}, "t": {"values": ["2024-01-03T00:00:00", "2024-01-03T01:00:00", "2024-01-03T02:00:00", "2024-01-03T03:00:00", "2024-01-03T04:00:00", "2024-01-03T05:00:00", "2024-01-03T06:00:00", "2024-01-03T07:00:00", "2024-01-03T08:00:00"]}}}, "ranges": {"t": {"type": "NdArray", "dataType": "float", "shape": [9], "axisNames": ["t"], "values": [298.9648132324219, 298.6933288574219, 298.9999694824219, 298.5683288574219, 298.9960632324219, 298.4452819824219, 299.05596923828125, 299.21807861328125, 298.95050048828125]}}}], "parameters": {"t": {"type": "Parameter", "description": "Temperature", "unit": {"symbol": "K"}, "observedProperty": {"id": "t", "label": {"en": "Temperature"}}}}, "referencing": [{"coordinates": ["x", "y", "z"], "system": {"type": "GeographicCRS", "id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"}}]} +{"type": "CoverageCollection", "domainType": "PointSeries", "coverages": [{"mars:metadata": {"class": "od", "Forecast date": "20240103T00", "domain": "g", "expver": "0001", "levtype": "sfc", "stream": "oper", "type": "fc", "number": 1}, "type": "Coverage", "domain": {"type": "Domain", "axes": {"x": {"values": [0.035149384216]}, "y": {"values": [0.0]}, "z": {"values": ["sfc"]}, "t": {"values": ["2024-01-03T00:00:00", "2024-01-03T01:00:00", "2024-01-03T02:00:00", "2024-01-03T03:00:00", "2024-01-03T04:00:00", "2024-01-03T05:00:00", "2024-01-03T06:00:00", "2024-01-03T07:00:00", "2024-01-03T08:00:00"]}}}, "ranges": {"2t": {"type": "NdArray", "dataType": "float", "shape": [9], "axisNames": ["t"], "values": [298.9648132324219, 298.6933288574219, 298.9999694824219, 298.5683288574219, 298.9960632324219, 298.4452819824219, 299.05596923828125, 299.21807861328125, 298.95050048828125]}}}], "parameters": {"2t": {"type": "Parameter", "description": "Temperature", "unit": {"symbol": "K"}, "observedProperty": {"id": "2t", "label": {"en": "Temperature"}}}}, "referencing": [{"coordinates": ["x", "y", "z"], "system": {"type": "GeographicCRS", "id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"}}]} diff --git a/tests/environment-unit-tests.yml b/tests/environment-unit-tests.yml index c7c870f7..9ba60f30 100644 --- a/tests/environment-unit-tests.yml +++ b/tests/environment-unit-tests.yml @@ -30,7 +30,7 @@ dependencies: - polytope-client>=0.7.4 - earthkit-meteo>=0.0.1 - git+https://github.com/ecmwf/earthkit-data-demo-source - - eccovjson>=0.0.5 + - covjsonkit>=0.0.25 - earthkit-geo>=0.2.0 - tqdm>=4.63.0 - lru-dict diff --git a/tests/readers/test_covjson_reader.py b/tests/readers/test_covjson_reader.py index 8f206081..aff5d801 100644 --- a/tests/readers/test_covjson_reader.py +++ b/tests/readers/test_covjson_reader.py @@ -11,7 +11,7 @@ import pytest from earthkit.data import from_source -from earthkit.data.testing import NO_ECCOVJSON +from earthkit.data.testing import NO_COVJSONKIT from earthkit.data.testing import earthkit_test_data_file @@ -20,7 +20,7 @@ def test_covjson(): assert ds -@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available") +@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available") def test_covjson_to_xarray(): ds = from_source("file", earthkit_test_data_file("time_series.covjson")) assert ds @@ -28,7 +28,7 @@ def test_covjson_to_xarray(): assert len(a.data_vars) == 1 -@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available") +@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available") def test_covjson_memory(): with open(earthkit_test_data_file("time_series.covjson"), "r") as f: d = f.read().encode() @@ -39,7 +39,7 @@ def test_covjson_memory(): assert len(a.data_vars) == 1 -@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available") +@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available") def test_covjson_stream(): stream = open(earthkit_test_data_file("time_series.covjson"), "rb") @@ -54,7 +54,7 @@ def test_covjson_stream(): next(it) -@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available") +@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available") def test_covjson_stream_memory(): stream = open(earthkit_test_data_file("time_series.covjson"), "rb")