-
Notifications
You must be signed in to change notification settings - Fork 300
Automatic reversal of DimCoord bounds #4466
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9041605
first pass at ensuring contiguous bounds
rcomer 6bb05c6
reduce scope and fix old tests
rcomer 901584f
bounds setter tests
rcomer e53c268
test contiguity preserved
rcomer e80cc2a
check bounds within reverse tests
rcomer 75e9632
add comment; merge test
rcomer df5f468
simpler approach
rcomer b6cdae1
revert now redundant changes
rcomer d749b57
update cml
rcomer b89f221
cell equality to ignore bound order
rcomer 7644e87
update cml
rcomer d0e3b56
move merge test to integration
rcomer 74871ad
review: simple actions
rcomer de53982
review: split up cube reverse tests
rcomer eaf9f94
review: check bounds in all cube reverse tests
rcomer d13879d
whatsnew
rcomer 0dea5af
review: reduce test repetition
rcomer 796015a
tweak whatsnew
rcomer 046ae42
blank line
rcomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright Iris contributors | ||
| # | ||
| # This file is part of Iris and is released under the LGPL license. | ||
| # See COPYING and COPYING.LESSER in the root of the repository for full | ||
| # licensing details. | ||
| """Integration tests for the :mod:`iris._merge` package.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Copyright Iris contributors | ||
| # | ||
| # This file is part of Iris and is released under the LGPL license. | ||
| # See COPYING and COPYING.LESSER in the root of the repository for full | ||
| # licensing details. | ||
| """ | ||
| Integration tests for merging cubes. | ||
| """ | ||
|
|
||
| # import iris tests first so that some things can be initialised | ||
| # before importing anything else. | ||
| import iris.tests as tests # isort:skip | ||
|
|
||
| from iris.coords import DimCoord | ||
| from iris.cube import Cube, CubeList | ||
|
|
||
|
|
||
| class TestContiguous(tests.IrisTest): | ||
| def test_form_contiguous_dimcoord(self): | ||
| # Test that cube sliced up and remerged in the opposite order maintains | ||
| # contiguity. | ||
| cube1 = Cube([1, 2, 3], "air_temperature", units="K") | ||
| coord1 = DimCoord([3, 2, 1], long_name="spam") | ||
| coord1.guess_bounds() | ||
| cube1.add_dim_coord(coord1, 0) | ||
| cubes = CubeList(cube1.slices_over("spam")) | ||
| cube2 = cubes.merge_cube() | ||
| coord2 = cube2.coord("spam") | ||
|
|
||
| self.assertTrue(coord2.is_contiguous()) | ||
| self.assertArrayEqual(coord2.points, [1, 2, 3]) | ||
| self.assertArrayEqual(coord2.bounds, coord1.bounds[::-1, ::-1]) | ||
rcomer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| tests.main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| <?xml version="1.0" ?> | ||
| <dimCoord bounds="[[27.75, 30.75], | ||
| [24.75, 27.75], | ||
| [21.75, 24.75], | ||
| [18.75, 21.75], | ||
| [15.75, 18.75], | ||
| [12.75, 15.75], | ||
| [9.75, 12.75], | ||
| [6.75, 9.75]]" id="43cd7f4a" long_name="foo" points="[30.0, 27.0, 24.0, 21.0, 18.0, 15.0, 12.0, 9.0]" shape="(8,)" units="Unit('meter')" value_type="float32"/> | ||
| <dimCoord bounds="[[30.75, 27.75], | ||
| [27.75, 24.75], | ||
| [24.75, 21.75], | ||
| [21.75, 18.75], | ||
| [18.75, 15.75], | ||
| [15.75, 12.75], | ||
| [12.75, 9.75], | ||
| [9.75, 6.75]]" id="43cd7f4a" long_name="foo" points="[30.0, 27.0, 24.0, 21.0, 18.0, 15.0, 12.0, 9.0]" shape="(8,)" units="Unit('meter')" value_type="float32"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.