Skip to content

Infer grid from UxDataArray inputs during UxDataset({"varname": uxarr, ...}) #1886

Open

Description

@Sevans711

Proposed new feature or change:

When creating a UxDataset, if any of the input data vars are UxDataArrays, the grid should probably be inferred directly, instead of requiring the user to input it separately.

For example:

import uxarray as ux
arrA = ux.tutorial.open_dataset('quad-hexagon-random-node')['random_data_node']
arrB = ux.tutorial.open_dataset('quad-hexagon-random-face')['random_data_face']
assert arrA.uxgrid == arrB.uxgrid
ds = ux.UxDataset({'A': arrA, 'B': arrB})
ds.uxgrid

I would have wanted ds.uxgrid to be auto-filled as arrA.uxgrid (which is equal to arrB.uxgrid), but instead this crashes with GridInvalidError. To produce the desired result, the user currently needs to explicitly specify ds = ux.UxDataset({'A': arrA, 'B': arrB}, uxgrid=arrA.uxgrid) instead.

Considering this feature in the first place is also what led me to finding a bug: the code currently does not run any checks to confirm that the input UxDataArrays' grids actually match the provided uxgrid. (This bug is being tracked separately; see #1853 (comment)).

Activity

  1. added
    new feature
    on Nov 9, 2026
  2. moved this from 📚 Backlog to 📝 To-Do in UXarray Developmenton Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new feature

    Type

    No type

    Fields

    Priority

    Low

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions