I would like interpolate a spatial data file (lat_old, long_old) to a different grid (lat_new, lon_new), where the grid size is different and latitudes are centered on zero.
I tried the following:
[X,Y]=meshgrid(lon_old,lat_old); [X_new,Y_new]=meshgrid(lon_new,lat_new); data_new= interp2(X,Y,data_old',X_new,Y_new);
However, the old longitudes are (0,360), while the new grid is centered on 0 (-180,180). The code above only performs interpolation for the positive part of the new grid, and yields NaN for negative longitude values (-180,0). (Please note that grid sizes are also different, and the new grid is centered on longitude 0)
How do I re-center 'data_old' with longitude values (0,360) to (-180,-180), before performing the interpolation to a new grid size?
Best Answer