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
11 changes: 11 additions & 0 deletions docs/release_notes/version_0.14_updates.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Version 0.14 Updates
/////////////////////////


Version 0.14.4
===============

Fixes
++++++

- Fixed issue when getting the "gridSpec" GRIB metadata key with a default value caused a crash when ecCodes 2.41.0 was used. (:pr:`719`).
- Now, dependencies for GeoTIFF support are not installed when earthkit-data is installed with ``pip install earthkit-data[all]``. This step was necessary to make installation work when GDAL is not available. These dependencies need to be installed separately with ``pip install earthkit-data[geotiff]``. See :ref:`install`. (:pr:`718`).


Version 0.14.3
===============

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies = [
"xarray>=0.19",
]
optional-dependencies.all = [
"earthkit-data[cds,covjsonkit,ecmwf-opendata,fdb,geo,geopandas,geotiff,mars,odb,polytope,projection,s3,wekeo]",
"earthkit-data[cds,covjsonkit,ecmwf-opendata,fdb,geo,geopandas,mars,odb,polytope,projection,s3,wekeo]",
]
optional-dependencies.cds = [ "cdsapi>=0.7.2" ]
optional-dependencies.ci = [ "numpy" ]
Expand Down
10 changes: 10 additions & 0 deletions src/earthkit/data/readers/grib/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ def get(self, name, ktype=None, **kwargs):
return self.get_values()
elif name == "md5GridSection":
return self.get_md5GridSection()
elif name == "gridSpec":
# Temporary measure because from ecCodes 2.41.0, when we ask for the gridSpec
# ecCodes raises a gribapi.errors.FunctionNotImplementedError exception, which is
# not caught by the high level eccodes API even if a default value is provided.
if "default" in kwargs:
try:
return super().get(name, ktype, **kwargs)
except Exception as e:
if "FunctionNotImplementedError" in str(type(e)):
return kwargs.get("default", None)

return super().get(name, ktype, **kwargs)

Expand Down
7 changes: 7 additions & 0 deletions tests/grib/test_grib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,13 @@ def test_grib_tilde_shortname(fl_type):
assert f[0].metadata(namespace="parameter")["shortName"] == "106"


def test_grib_gridspec_key():
ds = from_source("file", earthkit_examples_file("test.grib"))

ds[0].metadata("gridSpec", default=None) # Should not raise an error
ds.metadata("gridSpec", default=None) # Should not raise an error


if __name__ == "__main__":
from earthkit.data.testing import main

Expand Down
Loading