Skip to content

Commit 8f45591

Browse files
Feature/use covjsonkit (#524)
* Use covjsonkit instead of eccovjson
1 parent 2f3a9b9 commit 8f45591

File tree

9 files changed

+27
-18
lines changed

9 files changed

+27
-18
lines changed

docs/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Alternatively, you can install the following components:
4747
- odb: provides full support for the :ref:`odb` data type
4848
- geopandas: adds geojson/geopandas support
4949
- projection: adds projection support
50-
- eccovjson: provides access to coverage json data served by the :ref:`data-sources-polytope` source
50+
- covjsonkit: provides access to coverage json data served by the :ref:`data-sources-polytope` source
5151

5252
E.g. to add :ref:`data-sources-mars` support you can use:
5353

docs/release_notes/version_0.10_updates.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ Version 0.10 Updates
22
/////////////////////////
33

44

5+
Version 0.10.10
6+
===============
7+
8+
Changes
9+
+++++++
10+
11+
- Use ``covjsonkit`` instead of ``ecccovjson`` to read coverage json data retrieved from the :ref:`data-sources-polytope` source (:pr:`445`).
12+
13+
514
Version 0.10.9
615
===============
716

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies:
2727
- ecmwf-opendata>=0.1.2
2828
- polytope-client>=0.7.4
2929
- earthkit-meteo>=0.0.1
30-
- eccovjson>=0.0.5
30+
- covjsonkit>=0.0.25
3131
- earthkit-geo>=0.2.0
3232
- tqdm>=4.63.0
3333
- lru-dict

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies = [
5353
optional-dependencies.all = [
5454
"cartopy",
5555
"cdsapi>=0.7.2",
56-
"eccovjson>=0.0.5",
56+
"covjsonkit>=0.0.25",
5757
"ecmwf-api-client>=1.6.1",
5858
"ecmwf-opendata>=0.3.3",
5959
"geopandas",
@@ -69,11 +69,14 @@ optional-dependencies.ci = [
6969
"array-api-compat",
7070
"torch",
7171
]
72+
optional-dependencies.covjsonkit = [
73+
"covjsonkit>=0.0.25",
74+
]
7275
optional-dependencies.dev = [
7376
"cartopy",
7477
"cdsapi>=0.7.2",
78+
"covjsonkit>=0.0.25",
7579
"earthkit-data-demo-source",
76-
"eccovjson>=0.0.5",
7780
"ecmwf-api-client>=1.6.1",
7881
"ecmwf-opendata>=0.3.3",
7982
"geopandas",
@@ -88,9 +91,6 @@ optional-dependencies.dev = [
8891
"pytest-forked",
8992
"pytest-timeout",
9093
]
91-
optional-dependencies.eccovjson = [
92-
"eccovjson>=0.0.5",
93-
]
9494
optional-dependencies.ecmwf-opendata = [
9595
"ecmwf-opendata>=0.3.3",
9696
]

src/earthkit/data/readers/covjson.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
class XarrayMixIn:
1717
def to_xarray(self, **kwargs):
1818
try:
19-
from eccovjson.api import Eccovjson
19+
from covjsonkit.api import Covjsonkit
2020
except ImportError:
21-
raise ImportError("covjason handling requires 'eccovjson' to be installed")
21+
raise ImportError("covjason handling requires 'covjsonkit' to be installed")
2222

23-
decoder = Eccovjson().decode(self._json())
23+
decoder = Covjsonkit().decode(self._json())
2424
return decoder.to_xarray()
2525

2626

src/earthkit/data/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def modules_installed(*modules):
114114
NO_FDB = True
115115

116116
NO_POLYTOPE = not os.path.exists(os.path.expanduser("~/.polytopeapirc"))
117-
NO_ECCOVJSON = not modules_installed("eccovjson")
117+
NO_COVJSONKIT = not modules_installed("covjsonkit")
118118
NO_PYTORCH = not modules_installed("torch")
119119
NO_CUPY = not modules_installed("cupy")
120120
if not NO_CUPY:

tests/data/time_series.covjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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"}}]}
1+
{"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"}}]}

tests/environment-unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies:
3030
- polytope-client>=0.7.4
3131
- earthkit-meteo>=0.0.1
3232
- git+https://github.com/ecmwf/earthkit-data-demo-source
33-
- eccovjson>=0.0.5
33+
- covjsonkit>=0.0.25
3434
- earthkit-geo>=0.2.0
3535
- tqdm>=4.63.0
3636
- lru-dict

tests/readers/test_covjson_reader.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pytest
1212

1313
from earthkit.data import from_source
14-
from earthkit.data.testing import NO_ECCOVJSON
14+
from earthkit.data.testing import NO_COVJSONKIT
1515
from earthkit.data.testing import earthkit_test_data_file
1616

1717

@@ -20,15 +20,15 @@ def test_covjson():
2020
assert ds
2121

2222

23-
@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available")
23+
@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available")
2424
def test_covjson_to_xarray():
2525
ds = from_source("file", earthkit_test_data_file("time_series.covjson"))
2626
assert ds
2727
a = ds.to_xarray()
2828
assert len(a.data_vars) == 1
2929

3030

31-
@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available")
31+
@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available")
3232
def test_covjson_memory():
3333
with open(earthkit_test_data_file("time_series.covjson"), "r") as f:
3434
d = f.read().encode()
@@ -39,7 +39,7 @@ def test_covjson_memory():
3939
assert len(a.data_vars) == 1
4040

4141

42-
@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available")
42+
@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available")
4343
def test_covjson_stream():
4444
stream = open(earthkit_test_data_file("time_series.covjson"), "rb")
4545

@@ -54,7 +54,7 @@ def test_covjson_stream():
5454
next(it)
5555

5656

57-
@pytest.mark.skipif(NO_ECCOVJSON, reason="no eccovjson available")
57+
@pytest.mark.skipif(NO_COVJSONKIT, reason="no covjsonkit available")
5858
def test_covjson_stream_memory():
5959
stream = open(earthkit_test_data_file("time_series.covjson"), "rb")
6060

0 commit comments

Comments
 (0)