pcolorm line has empty line at 0 deg. longitude

4 ビュー (過去 30 日間)
ww
ww 2012 年 4 月 26 日
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

回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 4 月 26 日
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)];

カテゴリ

Help Center および File ExchangeData Import and Management についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by