Skip to content

Commit

Permalink
Catch warning of invalid NetCDF dataset name
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuu committed Dec 15, 2023
1 parent cd4cd73 commit 36b09d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion satpy/tests/writer_tests/test_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def test_save_dataset_a_digit_no_prefix_include_attr(self):
scn = Scene()
scn["1"] = xr.DataArray([1, 2, 3])
with TempFile() as filename:
scn.save_datasets(filename=filename, writer="cf", include_orig_name=True, numeric_name_prefix="")
with pytest.warns(UserWarning, match=r"Invalid NetCDF dataset name"):
scn.save_datasets(filename=filename, writer="cf", include_orig_name=True, numeric_name_prefix="")
with xr.open_dataset(filename) as f:
np.testing.assert_array_equal(f["1"][:], [1, 2, 3])
assert "original_name" not in f["1"].attrs
Expand Down

0 comments on commit 36b09d1

Please sign in to comment.