From f835fc970419eb80b6875dcc1400bed7e639057d Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Mon, 2 Dec 2024 10:16:12 +0000 Subject: [PATCH] Keyfix eccodes 2v38 (#578) * Create key alias to fix eccodes v2.38 change, with backwards compatibility. * Fix deprecated operation which fails for numpy 2. --- src/iris_grib/_load_convert.py | 2 +- src/iris_grib/message.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/iris_grib/_load_convert.py b/src/iris_grib/_load_convert.py index 1a055e15..d4003285 100644 --- a/src/iris_grib/_load_convert.py +++ b/src/iris_grib/_load_convert.py @@ -209,7 +209,7 @@ def _masker(item): # Non-standardised usage for negative forecast times. def _hindcast_fix(forecast_time): """Return a forecast time interpreted as a possibly negative value.""" - uft = np.uint32(forecast_time) + uft = np.array(forecast_time).astype(np.uint32) HIGHBIT = 2**30 # Workaround grib api's assumption that forecast time is positive. diff --git a/src/iris_grib/message.py b/src/iris_grib/message.py index aab46f81..9adcc3db 100644 --- a/src/iris_grib/message.py +++ b/src/iris_grib/message.py @@ -27,6 +27,8 @@ "longitudes": "longitude", # Support older form of key which used to exist before eccodes 2v36 "indicatorOfUnitForForecastTime": "indicatorOfUnitOfTimeRange", + # Support older name which became an alias at eccodes 2v38 + "numberOfTimeRange": "numberOfTimeRanges", }