uxarray
uxarray copied to clipboard
`_slice_from_grid` may need to use coords from a sliced dataarray
Version
v2024.08.2
How did you install UXarray?
Conda
What happened?
_slice_from_grid in UxDataArray create a new subset dataarray using coordinates info from the original dataarray as shown in the lines below:
https://github.com/UXARRAY/uxarray/blob/f71e11bef0fabe3ac74767767ad0509cef5cf504/uxarray/core/dataarray.py#L1099-L1106
This does not cause an issue when the original dataarray does not have coordinates that are sliced, but the constructor fails otherwise with a conflicting size for dimension. Probably a better or a right approach is creating a new sliced dataarray with coordinates from the sliced d_var not from the original self.
What did you expect to happen?
A new sliced (subset) dataarray needs to be created with a correctly sliced coordinate variables, not from the original unsliced coordinate variables.
Can you provide a MCVE to repoduce the bug?
No response