How to recenter spatial data?

9 views (last 30 days)
JMSE
JMSE on 2 Nov 2021
Commented: JMSE on 11 Nov 2021
I want to recenter spatial data from a grid of -180 to 180 lon to a grid of 0 - 360 lon. Using the command wrapTo360 leads to the issue below (see 2nd figure - you can see that the data > 180 shows an error). How can I reshape the rain/precipitation data accordingly so that the data is shifted correctly?
Help is very much appreciated.
dlat = load('latitude.mat');
lat = dlat.lat;
dlon = load('longitude.mat');
lon = dlon.lon;
dprec = load('rain.mat');
prec = dprec.prec;
lonW=wrapTo360(lon);
pcolor(lon,lat,prec);shading flat
pcolor(lonW,lat,prec);shading flat

Accepted Answer

Konrad
Konrad on 2 Nov 2021
hi,
maybe I didn't get it, but why not just add 180?
lonW = lon + 180;
  3 Comments
JMSE
JMSE on 11 Nov 2021
Many thanks, it helped a lot.

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!