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

Workaround for some cases that end up in #347 #419

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

forman
Copy link
Member

@forman forman commented Mar 9, 2021

Checklist:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/source/*
  • Changes documented in docs/CHANGES.md
  • AppVeyor and Travis CI passes
  • Test coverage remains or increases (target 100%) - not adressed, must remove entire method for this
  • Associated issues closed after merge

@forman forman requested review from TonioF and pont-us March 9, 2021 17:08
@forman forman self-assigned this Mar 9, 2021
@@ -136,7 +134,7 @@ def test_normalize_inverted_lat(self):
chunks={'time': 1})

actual = normalize_dataset(ds)
xr.testing.assert_equal(actual, expected)
xr.testing.assert_equal(actual, ds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check of this test is now that latitude is not inverted anymore. One might argue that we don't need it anymore at all. At least, remove the lines were the 'expected' dataset is built and rename the test to 'test_lat_not_inverted'.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the variable expected (lines 128-134) can be removed entirely, but I think it's still useful to keep the test itself as a definition of current behaviour, even if it's trivial. For the name I'd prefer test_normalize_on_increasing_latitudes, which just refers the input format rather than the expected behaviour, and means that there's one less place to update if/when we change it again. (I try to avoid/remove "inverted" where possible, because I find it ambiguous -- to me it just implies "the opposite of whatever we currently want in this context". "increasing" / "decreasing" are far clearer.)

# chunks in "lat" that have the smallest chunk first. This will
# fail when writing to Zarr. (Hack for #347)
# See also https://github.com/pydata/xarray/issues/2300
# ds = _ensure_lat_decreasing(ds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only commented out? Why not fully removed? And the whole method along with it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe because it's only intended as a temporary hack? Not sure...

Copy link
Member

@pont-us pont-us left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only trivial changes suggested.

@@ -136,7 +134,7 @@ def test_normalize_inverted_lat(self):
chunks={'time': 1})

actual = normalize_dataset(ds)
xr.testing.assert_equal(actual, expected)
xr.testing.assert_equal(actual, ds)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the variable expected (lines 128-134) can be removed entirely, but I think it's still useful to keep the test itself as a definition of current behaviour, even if it's trivial. For the name I'd prefer test_normalize_on_increasing_latitudes, which just refers the input format rather than the expected behaviour, and means that there's one less place to update if/when we change it again. (I try to avoid/remove "inverted" where possible, because I find it ambiguous -- to me it just implies "the opposite of whatever we currently want in this context". "increasing" / "decreasing" are far clearer.)

# chunks in "lat" that have the smallest chunk first. This will
# fail when writing to Zarr. (Hack for #347)
# See also https://github.com/pydata/xarray/issues/2300
# ds = _ensure_lat_decreasing(ds)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe because it's only intended as a temporary hack? Not sure...

@forman forman merged commit 2280c12 into master Mar 17, 2021
@forman forman deleted the forman-347-dont_reorder_lat branch March 17, 2021 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writing to zarr fails with message "specified zarr chunks would overlap multiple dask chunks"
3 participants