How to use m_pcolor and/or pcolorm
조회 수: 27 (최근 30일)
이전 댓글 표시
Anyone familiar with m_pcolor in the m_map package? I have a data set that includes columns of latitude longitude and ocean salinity values. I would like to use m_pcolor to map out the salinity on a gulf map I have already created. The code I have currently looks like this:
%Create the GoM coast map w/ bathymetric contours
m_proj('UTM','lon',[-98,-89],'lat',[26,30]);
%m_line([-92],[28]);
[cs,h]=m_etopo2;
[cs,h]=m_etopo2('contour',[-10,-100]);
m_grid;
%m_coast
load useast_coast_high_3.mat,lon,lat;
m_line([lon],[lat]);
hold on
fname = 'Whirl.txt';
[s1 s2 s3 s4 f5 f6 f7 f8 f9 f10 f11] = textread(fname, '%s %s %s %s %f %f %f %f %f %f %f',-1,'headerlines',1);
lat = f5; long = f6;
press = f7; temp = f8;
sal = f9; oxy = f10;
sigth = f11; stn = s2;
m_pcolor(f5,f6,sal)
hold off
When I run it, MATLAB draws the coastline, lat/lon grid lines, and the bathymetry lines but seems to ignore the m_pcolor command. But I'm also not getting any error messages so I can't tell where I'm going wrong.
Any tips?!
댓글 수: 0
답변 (1개)
Kelly Kearney
2011년 11월 22일
Looks like you reversed your latitude and longitude, which would place your grid outside the Gulf Coast frame. Try
m_pcolor(f6,f5,sal)
The Mapping Toolbox functions (including pcolorm) use the opposite order for lat-lon syntax
pcolorm(f5,f6,sal)
댓글 수: 3
Kelly Kearney
2011년 11월 22일
My first comment would be that it seems you're passing a vector of salinities rather than a lon x lat matrix; however, that would result in an error message. Other than that, your syntax looks correct. Ignoring without errors usually means my data is not where I meant it to be (like the lat/lon reversal); I'd double check the numbers.
참고 항목
카테고리
Help Center 및 File Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!