-
Notifications
You must be signed in to change notification settings - Fork 6
Description
When running nlmod.to_model_ds(...) the following error occurs when xarray version 2025.4.0 is installed: KeyError: "no index found for coordinate 'layer'" The error does not occur with xarray version 2024.6.0. The error is thrown by the remove_inactive_layers method
Line 1386 in 3bd6965
| ds = ds.sel(layer=(idomain > 0).any(idomain.dims[1:])) |
but the cause lies somewhere else. I traced it down to the interp method used here:
Line 166 in 3bd6965
| ds_out = ds_in.interp( |
Somewhere between xarray versions 2024.6.0 and 2025.4.0 the behaviour of this method must have changed: In the newer xarray version 'layer' is dropped from the DataSet's indexes attribute (causing the KeyError later down the track in remove_inactive_layers), in the older version it remains preserved.
Has anyone seen this before? Not sure what the best solution is (other than using an older xarray version).
Thanks,
Vincent