Skip to content
Open
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
6 changes: 0 additions & 6 deletions xbout/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,12 +1153,6 @@ def _open_grid(datapath, chunks, keep_xboundaries, keep_yboundaries, mxg=2, **kw

unrecognised_dims = list(set(grid.dims) - set(acceptable_dims))
if len(unrecognised_dims) > 0:
# Weird string formatting is a workaround to deal with possible bug in
# pytest warnings capture - doesn't match strings containing brackets
warn(
"Will drop all variables containing the dimensions {} because "
"they are not recognised".format(str(unrecognised_dims)[1:-1])
)
grid = grid.drop_dims(unrecognised_dims)

if keep_xboundaries:
Expand Down
21 changes: 0 additions & 21 deletions xbout/tests/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,6 @@ def test_open_grid(self, create_example_grid_file):
assert_equal(result, open_dataset(example_grid))
result.close()

def test_open_grid_extra_dims(self, create_example_grid_file, tmp_path_factory):
example_grid = open_dataset(create_example_grid_file)

new_var = DataArray(
name="new",
data=[[1, 2], [8, 9], [16, 17], [27, 28], [37, 38]],
dims=["x", "w"],
)

dodgy_grid_directory = tmp_path_factory.mktemp("dodgy_grid")
dodgy_grid_path = dodgy_grid_directory.joinpath("dodgy_grid.nc")
merge([example_grid, new_var]).to_netcdf(dodgy_grid_path, engine="h5netcdf")

with pytest.warns(
UserWarning, match="drop all variables containing " "the dimensions 'w'"
):
result = open_boutdataset(datapath=dodgy_grid_path)
result = result.drop_vars(["x", "y"])
assert_equal(result, example_grid)
result.close()

def test_open_grid_apply_geometry(self, create_example_grid_file):
@register_geometry(name="Schwarzschild")
def add_schwarzschild_coords(ds, coordinates=None):
Expand Down
Loading