Skip to content

Commit

Permalink
Simplify implementation because we can assume xarray 0.19
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverwm1 committed Jan 21, 2025
1 parent 4028ee8 commit dbda4c1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def test_dump_max_rows_default(tmp_xarray_ds):
assert len(result.output.split("\n")) > 30


@pytest.mark.skipif(xr.__version__ < "0.18.0", reason="need xarray v0.18.0 or higher")
def test_dump_max_rows_limited(tmp_xarray_ds):
runner = CliRunner()
_, path = tmp_xarray_ds(consolidated=True, n_vars=30)
Expand Down
6 changes: 1 addition & 5 deletions zarrdump/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ def dump(url: str, variable: str, max_rows: int, info: bool):
if object_is_xarray and info:
object_.info()
else:
try:
with xr.set_options(display_max_rows=max_rows):
print(object_)
except ValueError:
# xarray<v0.18.0 does not have display_max_rows option
with xr.set_options(display_max_rows=max_rows):
print(object_)


Expand Down

0 comments on commit dbda4c1

Please sign in to comment.