exoclim / aeolus

Analysis and visualisation of atmospheric model output powered by iris.
https://exoclim.github.io/aeolus
GNU Lesser General Public License v3.0
15 stars 4 forks source link

regrid_3d fails if dimensional coordinates have slightly different metadata #43

Open dennissergeev opened 2 years ago

dennissergeev commented 2 years ago

aeolus.coord.regrid_3d() fails if dimensional coordinates have slightly different metadata, e.g. var_name, even if the rest of the metadata is the same. The error comes from a supporting function, aeolus.coord.not_equal_coord_axes().

A temporary workaround is to fix or remove the offending attributes, e.g.

for cube in [cube1, cube2]:
    for coord_name in [um.z, um.y, um.x]:
        cube.coord(coord_name).var_name = coord_name  # or None
dannymcculloch commented 10 months ago

Fixed by using the iris regrid stucture. Works for 2D cubes

regridder = iris.analysis.Linear().regridder(cube_to_regrid, target_cube)
new_cube = regridder(cube_to_regrid)
new_cube