-
Notifications
You must be signed in to change notification settings - Fork 168
Cleaning up Field state #1989
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
Cleaning up Field state #1989
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bd4b67d
Remove Field._spatialhash
VeckoTheGecko 0a683d6
Remove Field._location
VeckoTheGecko 7a8de72
Add _core.utils subpackage
VeckoTheGecko 9549629
Remove Field._vertical_location
VeckoTheGecko 68bc637
Remove Field.lonlat_minmax
VeckoTheGecko b486ad8
Update GridAdapter to use composition
VeckoTheGecko 9303d58
Update Field to use GridAdapter
VeckoTheGecko dbbc290
bugfix kwarg
VeckoTheGecko 80b7cd4
xfail test_field_incompatible_combination[xarray-uxgrid]
VeckoTheGecko 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
Empty file.
Empty file.
Empty file.
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,28 @@ | ||
| from collections.abc import Hashable | ||
|
|
||
| DIM_TO_VERTICAL_LOCATION_MAP = { | ||
| "nz1": "center", | ||
| "nz": "face", | ||
| } | ||
|
|
||
|
|
||
| def get_vertical_location_from_dims(dims: tuple[Hashable, ...]): | ||
| """ | ||
| Determine the vertical location of the field based on the uxarray.UxDataArray object variables. | ||
|
|
||
| Only used for unstructured grids. | ||
| """ | ||
| vertical_dims_in_data = set(dims) & set(DIM_TO_VERTICAL_LOCATION_MAP.keys()) | ||
|
|
||
| if len(vertical_dims_in_data) != 1: | ||
| raise ValueError( | ||
| f"Expected exactly one vertical dimension ({set(DIM_TO_VERTICAL_LOCATION_MAP.keys())}) in the data, got {vertical_dims_in_data}" | ||
| ) | ||
|
|
||
| return DIM_TO_VERTICAL_LOCATION_MAP[vertical_dims_in_data.pop()] | ||
|
|
||
|
|
||
| def get_vertical_dim_name_from_location(location: str): | ||
| """Determine the vertical location of the field based on the uxarray.UxGrid object variables.""" | ||
| location_to_dim_map = {v: k for k, v in DIM_TO_VERTICAL_LOCATION_MAP.items()} | ||
| return location_to_dim_map[location] |
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
Oops, something went wrong.
Oops, something went wrong.
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.