Closed
Description
Bug description
I updated the pixi toml to xarray 2025.4.0 and some instances in the package sanity checks started to fail in the repr tests. Turned out these were the three HorizontalFlowBarrier instances we have in the tests. It turns out including the shapely line data in the dataset resulted (yet again) in an issue with xarray. The error is caused because it cannot compute an nbytes
on the xr.Variable
if it is an object array for some reason.
To reproduce
- Update pixi.toml to xarray >=2025.4.0
- Try to print a HorizontalFlowBarrier instance, or run the package sanity tests.
I can think of two possible solutions:
- Similar approach to how we override
deepcopy
: Override __repr__ (and _repr_html_), in this method first separate shapely data, put that into geodataframe, print the geodataframe separately followed by the leftover options in the xr.Dataset. - See if we can include the shapely data slightly differently in the Dataset, so that representing it works again.
The downside of 1. is that it gives the impression that the shapely line data is not included in the dataset, while it is.
The downside of 2. is that it might break again after an xarray update.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done