[Bug]: Regrid2 breaks in _output_axis_sizes()
if non-dimension Z axis coords exists (e.g., height
)
#616
Labels
type: bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
What happened?
The Regrid2 API breaks if there are multiple mappings to the "Z" axis, specifically for coordinate variables such as
height
which are not considered dimensions.xcdat/xcdat/regridder/regrid2.py
Line 94 in 104a5d5
xcdat/xcdat/regridder/regrid2.py
Lines 128 to 139 in 104a5d5
In the code above, we use
ds.cf.axes
mapping table and get the first matching list element for each axis ({y[0]: x for x, y in da.cf.axes.items()}
) . Let's say mapping table for Z looks like{"z": ["height", "lev"]}
. Our logic will use element 0height
instead oflev
, resulting inRuntimeError: Could not find axis 'lev', ensure 'lev' exists and the attributes are correct.
What did you expect to happen? Are there are possible answers you came across?
Current workaround: The user needs to drop
height
coordinate variable or any other non-dimensional Z coordinate beforehand.Solution: This should no longer be an issue on the latest
main
commit in PR #533 because we now usexc.get_dim_keys()
which maps axes by index (aka dimensions). -- NEED TO TESTMinimal Complete Verifiable Example (MVCE)
Example
Relevant log output
Anything else we need to know?
No response
Environment
v0.6.1 and all other versions that have Regrid2 with this logic
The text was updated successfully, but these errors were encountered: