Skip to content

Add UxDataArray.data_location property#1530

Open
rajeeja wants to merge 4 commits into
mainfrom
rajeeja/data_location_547
Open

Add UxDataArray.data_location property#1530
rajeeja wants to merge 4 commits into
mainfrom
rajeeja/data_location_547

Conversation

@rajeeja

@rajeeja rajeeja commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds a public UxDataArray.data_location property that reports where a data
variable is stored on the grid, addressing the long-open issue #547 (opened in
October 2023).

What it does

data_location infers the storage location from the grid dimension present on
the data variable and returns one of:

  • "face_centered" — data contains the n_face dimension
  • "node_centered" — data contains the n_node dimension
  • "edge_centered" — data contains the n_edge dimension
  • None — data is not mapped to the grid

This builds on the existing internal _face_centered() / _node_centered() /
_edge_centered() helpers and complements the existing data_mapping property.

Scope note

The original issue proposed a richer enumeration including face_average,
edge_orthogonal, edge_parallel, cgll, and dgll (with polynomial order
for 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

  • Add UxDataArray.data_location property (uxarray/core/dataarray.py)
  • Add it (and the existing data_mapping) to the API reference (docs/api.rst)
  • Add unit tests covering all three locations plus the non-grid / extra-dim
    cases (test/core/test_dataarray.py)

Closes #547

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
@rajeeja rajeeja requested a review from erogluorhan June 23, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UxDataArray.data_location

1 participant