ecmwf / earthkit-regrid

2 stars 0 forks source link

Fix interpolation with gaussian fieldlist input #28

Closed sandorkertesz closed 4 months ago

sandorkertesz commented 4 months ago

This PR fixes the issue when interpolation did not work with an earthkit-data fieldlist containing GRIB data on certain reduced Gaussian grids (e.g. O2560, O1280). In this case interpolate() failed to lookup the right interpolation matrix:

>>> out_grid = {"grid": [1,1]}
>>> data_interpolated = earthkit.regrid.interpolate(data, out_grid=out_grid, method="linear")
ValueError: No matrix found! in_grid=GridSpec({'type': 'reduced_gg', 'j_points_consecutive': 0, 'i_scans_negatively': 0, 'j_scans_positively': 0, 'grid': 'O2560', 'area': [89.973091, 0.0, -89.973091, 359.964899]}) out_grid={'grid': [1, 1]} method='linear'

The solution was to relax the checks used to match the area in the input data and the matrix registry.