Closed nhsavage closed 2 years ago
Example of the error message:
File "/home/b/b381943/mambaforge/envs/coretool26rc4/lib/python3.10/site-packages/iris/cube.py", line 4359, in regrid
regridder = scheme.regridder(self, grid)
File "/home/b/b381943/mambaforge/envs/coretool26rc4/lib/python3.10/site-packages/esmf_regrid/schemes.py", line 338, in regridder
return ESMFAreaWeightedRegridder(src_grid, tgt_grid, mdtol=self.mdtol)
File "/home/b/b381943/mambaforge/envs/coretool26rc4/lib/python3.10/site-packages/esmf_regrid/schemes.py", line 367, in __init__
regrid_info = _regrid_rectilinear_to_rectilinear__prepare(src_grid, tgt_grid)
File "/home/b/b381943/mambaforge/envs/coretool26rc4/lib/python3.10/site-packages/esmf_regrid/schemes.py", line 186, in _regrid_rectilinear_to_rectilinear__prepare
src_x = src_grid_cube.coord(axis="x")
File "/home/b/b381943/mambaforge/envs/coretool26rc4/lib/python3.10/site-packages/iris/cube.py", line 1908, in coord
raise iris.exceptions.CoordinateNotFoundError(emsg)
iris.exceptions.CoordinateNotFoundError: 'Expected to find exactly 1 coordinate, but found 2. They were: projection_x_coordinate, longitude.'
This should be closed by #217
🐛 Bug Report
When using Iris ESMF-regid to regrid data such as rotated pole data that includes auxiliary coords of true longitude two coords are returned not a single one
How To Reproduce
Steps to reproduce the behaviour:
cube = iris.load_cube('pr_AFR-22_NCC-NorESM1-M_historical_r1i1p1_CLMcom-KIT-CCLM5-0-15_v1_day_19500101-19501231.nc')
Expected behaviour
the aux coord should be ignored in favour of the dim coord
Screenshots
Environment
esmf_regrid
version:'0.4.0'Additional context
Click to expand this section...
We believe this can be resolved by having iris-esmf-regrid search `Coord`s using `dim_coord=True` in these searches: https://github.com/SciTools-incubator/iris-esmf-regrid/blob/7d6f568e8659109b5c8226f53dd27f5a5dd31f51/esmf_regrid/schemes.py#L184-L187 It should also fall back on the current implementation by using a try-except block. The only scenario producing an error would then be no `DimCoord`s and multiple `AuxCoord`s on the same axis, which is truly ambiguous and would need the user to help by massaging the input. See [here](https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab) for further details.