You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Infer grid from UxDataArray inputs during UxDataset({"varname": uxarr, ...}) #1886
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:
importuxarrayasuxarrA=ux.tutorial.open_dataset('quad-hexagon-random-node')['random_data_node']
arrB=ux.tutorial.open_dataset('quad-hexagon-random-face')['random_data_face']
assertarrA.uxgrid==arrB.uxgridds=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