-
Notifications
You must be signed in to change notification settings - Fork 300
Partial Collapse of Multidimensional Auxcoords with Bounds #3302
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
Partial Collapse of Multidimensional Auxcoords with Bounds #3302
Conversation
fbf3bf3 to
7deefda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great @rcomer !!
I just have a couple questions about the tests
| # Express main dims_to_collapse as non-negative integers | ||
| # and add the last (bounds specific) dimension. | ||
| dims_to_collapse = tuple( | ||
| dim % self.ndim for dim in dims_to_collapse) + (-1,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
| self.assertArrayEqual(collapsed_coord.bounds, np.array([[-2, 82], | ||
| [8, 92], | ||
| [18, 102], | ||
| [28, 112]])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split this into 3 tests? i.e. one test for each collapse operation.
My concern with having them all in the one test is that if the first one fails we won't know the result of the other two collapses until we get the first one working.
I realise test_numeric_nd() that already exists in this file does the same thing as you have done here, but I do think it's better practice to split the tests up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And perhaps add a test where the dimensions given are negative to test that handling is correct:
i.e.
collapsed_coord = coord.collapsed(-1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, and thanks for explaining why - it makes sense. Should I do the same with the lazy equivalent below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I do the same with the lazy equivalent below?
Yes please!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Also moved the dask import to the top of the module. This is consistent with other test modules that use dask.
Since I now have self.setupTestArrays((3, 4)) in 8 of the tests, I wondered about adding a setUp method to contain that. But there are a lot of tests on the class that don't need these arrays so not really sure what the better approach is.
43d0649 to
a1470f9
Compare
Proposed fix for #3298.