how to re-center spatial data (longitudes centered on 0) before grid interpolation?

1 visualizzazione (ultimi 30 giorni)
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?

Risposta accettata

KSSV
KSSV il 23 Giu 2016
To change 0 to 360 grid to -180 to +180, you need not to interpolate. Check resolution between 0 to 360, take the same resolution from -180 to +180 and replace 0 to 360 with -180 to +180. Once you have done this, then you may go for interpolation to get the grid for any other resolution.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by