diff --git a/.gitignore b/.gitignore index f1ca7c3b..28c93192 100644 --- a/.gitignore +++ b/.gitignore @@ -124,3 +124,6 @@ dmypy.json # Pyre type checker .pyre/ + +# VSCode settings +.vscode/ diff --git a/ci/environment-docs.yml b/ci/environment-docs.yml index d06b2376..71f8ebb9 100644 --- a/ci/environment-docs.yml +++ b/ci/environment-docs.yml @@ -9,7 +9,7 @@ dependencies: - xarray - xarray-datatree - h5netcdf - - h5py<3.9 + - h5py - pandas - cfgrib - cftime diff --git a/ci/environment-py310.yml b/ci/environment-py310.yml index 021b150f..6aa0f568 100644 --- a/ci/environment-py310.yml +++ b/ci/environment-py310.yml @@ -9,7 +9,7 @@ dependencies: - xarray - xarray-datatree - h5netcdf - - h5py<3.9 + - h5py - pandas - cfgrib - cftime diff --git a/ci/environment-py311.yml b/ci/environment-py311.yml index d680ae71..13d50302 100644 --- a/ci/environment-py311.yml +++ b/ci/environment-py311.yml @@ -9,7 +9,7 @@ dependencies: - xarray - xarray-datatree - h5netcdf - - h5py<3.9 + - h5py - pandas - cfgrib - cftime diff --git a/kerchunk/grib2.py b/kerchunk/grib2.py index 0003cd79..2eb49d39 100644 --- a/kerchunk/grib2.py +++ b/kerchunk/grib2.py @@ -252,9 +252,11 @@ def scan_grib( z[varName].attrs["_ARRAY_DIMENSIONS"] = dims for coord in cfgrib.dataset.COORD_ATTRS: - coord2 = {"latitude": "latitudes", "longitude": "longitudes"}.get( - coord, coord - ) + coord2 = { + "latitude": "latitudes", + "longitude": "longitudes", + "step": "step:int", + }.get(coord, coord) try: x = m.get(coord2) except eccodes.WrongStepUnitError as e: diff --git a/kerchunk/tests/test_combine.py b/kerchunk/tests/test_combine.py index 94538d80..5715a135 100644 --- a/kerchunk/tests/test_combine.py +++ b/kerchunk/tests/test_combine.py @@ -730,7 +730,7 @@ def test_cftimes_to_normal(refs): engine="zarr", chunks={}, ) - assert z.time.dtype == "M8[s]" + assert z.time.dtype.kind == "M" assert ( z.time.values == np.array(["1970-02-01T00:00:00", "1970-03-01T00:00:00"], dtype="M8[s]") @@ -799,7 +799,7 @@ def test_chunk_error(refs): refs1 = refs["single1"]["refs"] refs2 = refs1.copy() refs2.pop(".zmetadata") - fs = fsspec.filesystem("reference", fo=refs2, remote_protocol="memory") + fs = fsspec.filesystem("reference", fo=refs2, remote_protocol="memory") # noqa refs2[ "data/.zarray" ] = b""" diff --git a/kerchunk/tests/test_grib.py b/kerchunk/tests/test_grib.py index f6835a30..e0117ab1 100644 --- a/kerchunk/tests/test_grib.py +++ b/kerchunk/tests/test_grib.py @@ -1,5 +1,6 @@ import os.path +import eccodes import fsspec import numpy as np import pytest @@ -15,6 +16,7 @@ correct_hrrr_subhf_step, ) +eccodes_ver = tuple(int(i) for i in eccodes.__version__.split(".")) cfgrib = pytest.importorskip("cfgrib") here = os.path.dirname(__file__) @@ -49,7 +51,10 @@ def _fetch_first(url): @pytest.mark.parametrize( "url", [ - "s3://noaa-hrrr-bdp-pds/hrrr.20140730/conus/hrrr.t23z.wrfsubhf08.grib2", + pytest.param( + "s3://noaa-hrrr-bdp-pds/hrrr.20140730/conus/hrrr.t23z.wrfsubhf08.grib2", + marks=pytest.mark.skipif(eccodes_ver >= (2, 34), reason="eccodes too new"), + ), "s3://noaa-gefs-pds/gefs.20221011/00/atmos/pgrb2ap5/gep01.t00z.pgrb2a.0p50.f570", "s3://noaa-gefs-retrospective/GEFSv12/reforecast/2000/2000010100/c00/Days:10-16/acpcp_sfc_2000010100_c00.grib2", ], @@ -105,13 +110,11 @@ def test_grib_tree(): zg = zarr.open_group(fs.get_mapper("")) assert isinstance(zg["refc/instant/atmosphere/refc"], zarr.Array) assert isinstance(zg["vbdsf/avg/surface/vbdsf"], zarr.Array) - assert ( - zg["vbdsf/avg/surface"].attrs["coordinates"] - == "surface latitude longitude time valid_time step" + assert set(zg["vbdsf/avg/surface"].attrs["coordinates"].split()) == set( + "surface latitude longitude step time valid_time".split() ) - assert ( - zg["refc/instant/atmosphere"].attrs["coordinates"] - == "atmosphere latitude longitude step time valid_time" + assert set(zg["refc/instant/atmosphere"].attrs["coordinates"].split()) == set( + "atmosphere latitude longitude step time valid_time".split() ) # Assert that the fill value is set correctly assert zg.refc.instant.atmosphere.step.fill_value is np.NaN