pcolorm line has empty line at 0 deg. longitude
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to plot some NetCDF data on a global map. The data comes in a 2D matix and two vectors for lat and lon from the atmospheric model: size(lat)= 192 1 lat = -90:0.9375:90
size(lon)= 288 lon = 0:1.25:358.75
size(data)= 192 288
when I plot it:
worldmap world; coast = load('coast'); plotm(coast.lat, coast.long); pcolorm(lat,lon,data_matrix);
I get a map with a vertical line in the middle of it where there is no color (between lon = 358.75 and lon = 0.
NetCDF is a common file format for atmospheric data, so i dont think it is at fault. Matlab seems to be too stupid to understand that 0 and 360 are the same longitudes, and therefore doesn't 'connect the dots'..
Any fixes for this? Thanks
0 Commenti
Risposte (1)
Sean de Wolski
il 26 Apr 2012
You need to explicitly tell MATLAB that you want it to wrap aroubnd by adding a 360 or a 0 ar the end of you longitude vector. Right now it doesn't realize that you want it to wrap around. This is the correct behavior, in this case, you are 1.25 degrees off from a full circle and MATLAB reflects this.
lat = -90:0.9375:90;
lon = [0:1.25:358.75 360];
worldmap world;
coast = load('coast');
plotm(coast.lat, coast.long);
pcolorm(lat,lon,rand(numel(lat),numel(lon)));
If you want the value of zero to be reflected, concatenate the first column to the right side of data_matrix, i.e:
data_matrix = [data_matrix data_matrix(:,1)];
0 Commenti
Vedere anche
Categorie
Scopri di più su NetCDF in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!