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
Topological aggregations drop coordinates and attributes #1665
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 goner.attrs# {} <- units goner.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.
Also cleaning up the root cause of the duplication while fixing this: the same coord-filtering logic existed at eight sites across dataarray.py, the aggregations, the remap backends, and the cross sections. #1666 now routes all of them through a single shared helper, which also fixes the YAC weights path that was silently dropping non-dimension coordinates in the same way.
Activity
rajeeja commentedon Aug 13, 2026
Also cleaning up the root cause of the duplication while fixing this: the same coord-filtering logic existed at eight sites across
dataarray.py, the aggregations, the remap backends, and the cross sections. #1666 now routes all of them through a single shared helper, which also fixes the YAC weights path that was silently dropping non-dimension coordinates in the same way.