Add UxDataArray.data_location property#1530
Open
rajeeja wants to merge 4 commits into
Open
Conversation
Adds a public data_location property that reports where a data variable is stored on the grid (face_centered, node_centered, edge_centered, or None), inferred from the grid dimension present. Also documents the property in the API reference. Closes #547
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Adds a public
UxDataArray.data_locationproperty that reports where a datavariable is stored on the grid, addressing the long-open issue #547 (opened in
October 2023).
What it does
data_locationinfers the storage location from the grid dimension present onthe data variable and returns one of:
"face_centered"— data contains then_facedimension"node_centered"— data contains then_nodedimension"edge_centered"— data contains then_edgedimensionNone— data is not mapped to the gridThis builds on the existing internal
_face_centered()/_node_centered()/_edge_centered()helpers and complements the existingdata_mappingproperty.Scope note
The original issue proposed a richer enumeration including
face_average,edge_orthogonal,edge_parallel,cgll, anddgll(with polynomial orderfor the spectral-element cases). Those locations cannot be inferred from a data
variable's dimensions alone and are not currently representable in UXarray, so
this PR implements the three locations that are reliably determinable today and
documents the rest as not-yet-distinguished. Happy to extend the enum if/when
the underlying metadata becomes available.
Changes
UxDataArray.data_locationproperty (uxarray/core/dataarray.py)data_mapping) to the API reference (docs/api.rst)cases (
test/core/test_dataarray.py)Closes #547