-
Notifications
You must be signed in to change notification settings - Fork 300
Allowing exemption to axis guessing on coords #5551
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
32 commits
Select commit
Hold shift + click to select a range
6b49b10
allowing excemption to axis guessing on coords
HGWright 093372c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] eafa1d0
updating pr
HGWright d42a2b7
merge commit
HGWright e942b32
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 875f827
remove from metadata
HGWright 056defa
merge conflict
HGWright 8cd64b2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 047f58b
remove merge clash
HGWright 247feb1
Merge branch 'guess_coord' of github.com:HGWright/iris into guess_coord
HGWright 724d05f
adding review comments
HGWright 3d183f5
more review changes
HGWright c901c12
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a121ec4
parametrise and add tests
HGWright a7e6aa9
precommit changes
HGWright b5da396
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6020a63
fix last test
HGWright cffa5b6
Merge branch 'guess_coord' of github.com:HGWright/iris into guess_coord
HGWright a9a45d1
addressing review comments
HGWright 4151a7a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] c35c3d1
fix test failure
HGWright 3e6fba8
Merge branch 'guess_coord' of github.com:HGWright/iris into guess_coord
HGWright d643915
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5033391
add whatsnew and conftest files
HGWright faf4188
fix merge conflict
HGWright ed4c4c2
fix sentence
HGWright 0180f58
Merge branch 'main' into guess_coord
HGWright cfbe34f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6af7f81
fix flake8
HGWright c8854d3
Merge branch 'guess_coord' of github.com:HGWright/iris into guess_coord
HGWright 19dd66e
fix last test
HGWright b01f3f8
update whatsnew
HGWright 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,14 @@ | ||
| # Copyright Iris contributors | ||
| # | ||
| # This file is part of Iris and is released under the BSD license. | ||
| # See LICENSE in the root of the repository for full licensing details. | ||
| """Unit tests fixture infra-structure.""" | ||
| import pytest | ||
|
|
||
| import iris | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def sample_coord(): | ||
| sample_coord = iris.coords.DimCoord(points=(1, 2, 3, 4, 5)) | ||
| return sample_coord |
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,50 @@ | ||
| # Copyright Iris contributors | ||
| # | ||
| # This file is part of Iris and is released under the BSD license. | ||
| # See LICENSE in the root of the repository for full licensing details. | ||
| """Test function :func:`iris.util.guess_coord_axis`.""" | ||
|
|
||
| import pytest | ||
|
|
||
| from iris.util import guess_coord_axis | ||
|
|
||
|
|
||
| class TestGuessCoord: | ||
| @pytest.mark.parametrize( | ||
| "coordinate, axis", | ||
| [ | ||
| ("longitude", "X"), | ||
| ("grid_longitude", "X"), | ||
| ("projection_x_coordinate", "X"), | ||
| ("latitude", "Y"), | ||
| ("grid_latitude", "Y"), | ||
| ("projection_y_coordinate", "Y"), | ||
| ], | ||
| ) | ||
| def test_coord(self, coordinate, axis, sample_coord): | ||
| sample_coord.standard_name = coordinate | ||
| assert guess_coord_axis(sample_coord) == axis | ||
|
|
||
| @pytest.mark.parametrize( | ||
| "units, axis", | ||
| [ | ||
| ("hPa", "Z"), | ||
| ("days since 1970-01-01 00:00:00", "T"), | ||
| ], | ||
| ) | ||
| def test_units(self, units, axis, sample_coord): | ||
| sample_coord.units = units | ||
| assert guess_coord_axis(sample_coord) == axis | ||
|
|
||
| @pytest.mark.parametrize( | ||
| "ignore_axis, result", | ||
| [ | ||
| (True, None), | ||
| (False, "X"), | ||
| ], | ||
| ) | ||
| def test_ignore_axis(self, ignore_axis, result, sample_coord): | ||
| sample_coord.standard_name = "longitude" | ||
| sample_coord.ignore_axis = ignore_axis | ||
|
|
||
| assert guess_coord_axis(sample_coord) == result |
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.