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 15caf468..52b02269 100644 --- a/kerchunk/grib2.py +++ b/kerchunk/grib2.py @@ -250,9 +250,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 e9fe73ed..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]") diff --git a/kerchunk/tests/test_grib.py b/kerchunk/tests/test_grib.py index b7ac5253..43752007 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", ], @@ -111,13 +116,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