pcolorm line has empty line at 0 deg. longitude
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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)];
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Management에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!