While reviewing #1588 I went digging through aggregation.py and came across this, which turns out to be broken on main already, independent of that PR.
_node_to_face_aggregation and _node_to_edge_aggregation rebuild the output from data/dims/name only, so all coordinates and variable attributes are dropped. The result keeps its time dimension but loses the time coordinate:
uxda = ux.UxDataArray(data, dims=("time", "n_node"),
coords={"time": pd.date_range("2000-01-01", periods=6, freq="MS")},
uxgrid=grid, attrs={"units": "m"})
r = uxda.topological_mean(destination="face")
r.coords # [] <- time gone
r.attrs # {} <- units gone
r.sel(time="2000-03-01") # KeyError: 'time'
r.groupby("time.season") # KeyError: 'time'
r.resample(time="QS") # TypeError: Only valid with DatetimeIndex...
CI misses it because the existing tests use areaTriangle, which is 1-D with no leading coordinate, so there is nothing to lose.
This is also relevant to #1588: the dask paths added there go through apply_ufunc, which propagates coords and attrs for free, so on that branch the numpy and dask paths disagree and .chunk() starts deciding whether .sel(time=...) works. Fixing the numpy path on main makes them agree.
While reviewing #1588 I went digging through
aggregation.pyand came across this, which turns out to be broken onmainalready, independent of that PR._node_to_face_aggregationand_node_to_edge_aggregationrebuild the output fromdata/dims/nameonly, so all coordinates and variable attributes are dropped. The result keeps itstimedimension but loses thetimecoordinate:CI misses it because the existing tests use
areaTriangle, which is 1-D with no leading coordinate, so there is nothing to lose.This is also relevant to #1588: the dask paths added there go through
apply_ufunc, which propagates coords and attrs for free, so on that branch the numpy and dask paths disagree and.chunk()starts deciding whether.sel(time=...)works. Fixing the numpy path onmainmakes them agree.