Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "edition" from GLOBAL_ATTRIBUTES_KEYS #234

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cfgrib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# Edition-independent keys in ecCodes namespaces. Documented in:
# https://software.ecmwf.int/wiki/display/ECC/GRIB%3A+Namespaces
#
GLOBAL_ATTRIBUTES_KEYS = ["edition", "centre", "centreDescription", "subCentre"]
GLOBAL_ATTRIBUTES_KEYS = ["centre", "centreDescription", "subCentre"]

DATA_ATTRIBUTES_KEYS = [
"paramId",
Expand Down
2 changes: 0 additions & 2 deletions tests/test_20_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ def test_Message_write(tmpdir):
# warn on errors
res["centreDescription"] = "DUMMY"
assert res["centreDescription"] != "DUMMY"
res["edition"] = -1
assert res["edition"] != -1

# ignore errors
res.errors = "ignore"
Expand Down
5 changes: 0 additions & 5 deletions tests/test_30_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def test_Dataset():
assert "Conventions" in res.attributes
assert "institution" in res.attributes
assert "history" in res.attributes
assert res.attributes["GRIB_edition"] == 1
assert tuple(res.dimensions.keys()) == (
"number",
"time",
Expand All @@ -146,15 +145,13 @@ def test_Dataset_no_encode():
assert "Conventions" in res.attributes
assert "institution" in res.attributes
assert "history" in res.attributes
assert res.attributes["GRIB_edition"] == 1
assert tuple(res.dimensions.keys()) == ("number", "dataDate", "dataTime", "level", "values")
assert len(res.variables) == 9


def test_Dataset_encode_cf_time():
res = dataset.open_file(TEST_DATA, encode_cf=("time",))
assert "history" in res.attributes
assert res.attributes["GRIB_edition"] == 1
assert tuple(res.dimensions.keys()) == ("number", "time", "level", "values")
assert len(res.variables) == 9

Expand All @@ -165,7 +162,6 @@ def test_Dataset_encode_cf_time():
def test_Dataset_encode_cf_geography():
res = dataset.open_file(TEST_DATA, encode_cf=("geography",))
assert "history" in res.attributes
assert res.attributes["GRIB_edition"] == 1
assert tuple(res.dimensions.keys()) == (
"number",
"dataDate",
Expand All @@ -183,7 +179,6 @@ def test_Dataset_encode_cf_geography():
def test_Dataset_encode_cf_vertical():
res = dataset.open_file(TEST_DATA, encode_cf=("vertical",))
assert "history" in res.attributes
assert res.attributes["GRIB_edition"] == 1
expected_dimensions = ("number", "dataDate", "dataTime", "isobaricInhPa", "values")
assert tuple(res.dimensions.keys()) == expected_dimensions
assert len(res.variables) == 9
Expand Down
11 changes: 6 additions & 5 deletions tests/test_40_xarray_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
def test_open_dataset():
res = xarray_store.open_dataset(TEST_DATA)

assert res.attrs["GRIB_edition"] == 1
print(res.attrs)
assert res.attrs["GRIB_centre"] == "ecmf"

var = res["t"]
assert var.attrs["GRIB_gridType"] == "regular_ll"
Expand All @@ -41,7 +42,7 @@ def test_open_dataset():
def test_open_dataset_corrupted():
res = xarray_store.open_dataset(TEST_CORRUPTED)

assert res.attrs["GRIB_edition"] == 1
assert res.attrs["GRIB_centre"] == "ecmf"
assert len(res.data_vars) == 1

with pytest.raises(Exception):
Expand All @@ -52,7 +53,7 @@ def test_open_dataset_encode_cf_time():
backend_kwargs = {"encode_cf": ("time",)}
res = xarray_store.open_dataset(TEST_DATA, backend_kwargs=backend_kwargs)

assert res.attrs["GRIB_edition"] == 1
assert res.attrs["GRIB_centre"] == "ecmf"
assert res["t"].attrs["GRIB_gridType"] == "regular_ll"
assert res["t"].attrs["GRIB_units"] == "K"
assert res["t"].dims == ("number", "time", "level", "values")
Expand All @@ -74,7 +75,7 @@ def test_open_dataset_encode_cf_geography():
backend_kwargs = {"encode_cf": ("geography",)}
res = xarray_store.open_dataset(TEST_DATA, backend_kwargs=backend_kwargs)

assert res.attrs["GRIB_edition"] == 1
assert res.attrs["GRIB_centre"] == "ecmf"

var = res["t"]
assert var.attrs["GRIB_gridType"] == "regular_ll"
Expand All @@ -87,7 +88,7 @@ def test_open_dataset_encode_cf_geography():
def test_open_dataset_eccodes():
res = xarray_store.open_dataset(TEST_DATA)

assert res.attrs["GRIB_edition"] == 1
assert res.attrs["GRIB_centre"] == "ecmf"

var = res["t"]
assert var.attrs["GRIB_gridType"] == "regular_ll"
Expand Down