Skip to content

Commit

Permalink
Merge pull request #399 from ecmwf/shahramn-patch-2
Browse files Browse the repository at this point in the history
Update test_40_xarray_store.py
  • Loading branch information
iainrussell authored Aug 30, 2024
2 parents bbaf8ce + bfe10ff commit 454510e
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tests/test_40_xarray_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,16 @@ def test_open_datasets_different_step_types() -> None:
res = xarray_store.open_datasets(TEST_DATA_DIFFERENT_STEP_TYPES)

assert len(res) == 2
assert res[0].cpr.attrs["GRIB_stepType"] == "instant"
try:
cpr0 = res[0]["cpr"]
cpr1 = res[1]["cpr"]
except KeyError:
print("Using the old shortName for Convective precipitation rate")
cpr0 = res[0]["cprat"]
cpr1 = res[1]["cprat"]
assert cpr0.attrs["GRIB_stepType"] == "instant"
assert res[0].cfrzr.attrs["GRIB_stepType"] == "instant"
assert res[1].cpr.attrs["GRIB_stepType"] == "avg"
assert cpr1.attrs["GRIB_stepType"] == "avg"
assert res[1].cfrzr.attrs["GRIB_stepType"] == "avg"


Expand All @@ -153,9 +160,16 @@ def test_open_datasets_different_step_types_zeros() -> None:
res = xarray_store.open_datasets(TEST_DATA_DIFFERENT_STEP_TYPES_ZEROS)

assert len(res) == 2
assert res[0].cpr.attrs["GRIB_stepType"] == "instant"
try:
cpr0 = res[0]["cpr"]
cpr1 = res[1]["cpr"]
except KeyError:
print("Using the old shortName for Convective precipitation rate")
cpr0 = res[0]["cprat"]
cpr1 = res[1]["cprat"]
assert cpr0.attrs["GRIB_stepType"] == "instant"
assert res[0].cfrzr.attrs["GRIB_stepType"] == "instant"
assert res[1].cpr.attrs["GRIB_stepType"] == "avg"
assert cpr1.attrs["GRIB_stepType"] == "avg"
assert res[1].cfrzr.attrs["GRIB_stepType"] == "avg"


Expand Down

0 comments on commit 454510e

Please sign in to comment.