I want to regrid georeferenced data to a specific grid with a different resolution on the lat and on the lon dimensions. Before I would use basemap.interp
, but this basemap is dead.
I am experimenting with the metpy
package, and metpy.interpolate_to_points
seems the right candidate. Only, from the documentation I can't work out the format of the parameters I should enter.
It reads:
points (array_like, shape (n, D)) – Coordinates of the data points. values (array_like, shape (n,)) – Values of the data points. xi (array_like, shape (M, D)) – Points to interpolate the data onto.
Regarding 'points' I have tried providing them as 1-D arrays, as 2-D meshgrids (obtained with np.meshgrid), and in either lon first or lat first fashion. Same for 'xi'. For example:
from metpy.interpolate import interpolate_to_points
out_lons, out_lats = np.meshgrid(out_lons_1Darray, out_lats_1Darray)
downscaled_array = interpolate_to_points( [in_lons, in_lats], input_array, [out_lons, out_lats] )
From whichever attempt I get ValueError: operands could not be broadcast together with shapes (192,) (288,)
Any suggestion where I am wrong is greatly appreciated.