diff --git a/docs/examples/healpix_fieldlist.ipynb b/docs/examples/healpix_fieldlist.ipynb index 676e933..56400d5 100644 --- a/docs/examples/healpix_fieldlist.ipynb +++ b/docs/examples/healpix_fieldlist.ipynb @@ -79,7 +79,7 @@ " \"url\", \n", " \"https://get.ecmwf.int/repository/test-data/earthkit-regrid/examples/H8_nested_multi.grib2\")\n", "\n", - "# the target grid is a global 5x5 degree regular latitude grid\n", + "# the target grid is a global 5x5 degree regular latitude-longitude grid\n", "out_grid = {\"grid\": [5,5]}\n", "\n", "# perform interpolation for each field and add results \n", diff --git a/docs/examples/octahedral_fieldlist.ipynb b/docs/examples/octahedral_fieldlist.ipynb index 27c2776..afdb288 100644 --- a/docs/examples/octahedral_fieldlist.ipynb +++ b/docs/examples/octahedral_fieldlist.ipynb @@ -79,7 +79,7 @@ " \"url\", \n", " \"https://get.ecmwf.int/repository/test-data/earthkit-regrid/examples/O32_multi.grib2\")\n", "\n", - "# the target grid is a global 5x5 degree regular latitude grid\n", + "# the target grid is a global 5x5 degree regular latitude-longitude grid\n", "out_grid = {\"grid\": [5,5]}\n", "\n", "# perform interpolation for each field and add results \n", diff --git a/docs/release_notes/version_0.3_updates.rst b/docs/release_notes/version_0.3_updates.rst index b35bd93..8ab9571 100644 --- a/docs/release_notes/version_0.3_updates.rst +++ b/docs/release_notes/version_0.3_updates.rst @@ -1,6 +1,13 @@ Version 0.3 Updates ///////////////////////// +Version 0.3.4 +=============== + +Fixes +++++++++++++++++ +- fixed issue when the "grid" value in a gridspec could not be specified as a tuple + Version 0.3.3 =============== @@ -33,7 +40,7 @@ New features ++++++++++++++++ - restructured and regenerated matrix inventory - allow using the ``method`` keyword in :func:`interpolate` to specify the interpolation method -- allow using earthkit-data GRIB :xref:`fieldlist` in :func:`interpolate` as input data. This only works when the output grid is regular a latitude-longitude grid. This feature requires :xref:`earthkit-data` >= 0.6.0 +- allow using earthkit-data GRIB :xref:`fieldlist` in :func:`interpolate` as input data. This only works when the output grid is a regular latitude-longitude grid. This feature requires :xref:`earthkit-data` >= 0.6.0 - added notebook examples: - :ref:`/examples/healpix_fieldlist.ipynb` diff --git a/src/earthkit/regrid/gridspec.py b/src/earthkit/regrid/gridspec.py index ed68f7d..fe1966e 100644 --- a/src/earthkit/regrid/gridspec.py +++ b/src/earthkit/regrid/gridspec.py @@ -51,10 +51,18 @@ def __init__(self, gs): self._global_ns = None super().__init__(gs) + @staticmethod + def _normalise(d): + for k, v in d.items(): + if isinstance(v, tuple): + d[k] = list(v) + @staticmethod def from_dict(d): gs = dict(GridSpec.DEFAULTS) gs.update(d) + GridSpec._normalise(gs) + t_name, t = GridSpec._infer_spec_type(gs) if t is None: raise ValueError(f"Unsupported gridspec={d}") diff --git a/tests/test_gridspec.py b/tests/test_gridspec.py index fd08520..2b2d32b 100644 --- a/tests/test_gridspec.py +++ b/tests/test_gridspec.py @@ -82,6 +82,7 @@ ), ({"grid": "H128"}, {"grid": [1, 1]}), ({"grid": "H128", "ordering": "ring"}, {"grid": [1, 1]}), + ({"grid": (5, 5)}, {"grid": (10, 10)}), ], ) def test_gridspec_ok(gs_in, gs_out):