[Bug]: ds.regridder.vertical()
breaks with KeyError: 0
if grid_positions=None
and input_grid
has multiple Z axis
#519
Labels
type: bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
Milestone
What happened?
The code below assumes the input grid has a single set of Z axis coordinates (e.g., just "lev").
xcdat/xcdat/regridder/xgcm.py
Lines 242 to 245 in 870b334
If a dataset has multiple Z axis (e.g., "lev" and "ilev"), then the indexing will break on lines 253-255. This is because
coord_z
will be an xr.Dataset containing multiple Z axis. xr.Dataset cannot be indexed by position (e.g.,coord_z[0]
).xcdat/xcdat/regridder/xgcm.py
Lines 252 to 255 in 870b334
What did you expect to happen? Are there are possible answers you came across?
The fix:
coord_z should now be an xr.DataArray of the single Z axis for
data_var
.Minimal Complete Verifiable Example (MVCE)
Relevant log output
Anything else we need to know?
No response
Environment
xcdat=0.6.0rc1 (and
main
branch)The text was updated successfully, but these errors were encountered: