How to use m_pcolor and/or pcolorm

27 次查看(过去 30 天)
Chelsey
Chelsey 2011-11-22
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?!

回答(1 个)

Kelly Kearney
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
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.
Chelsey
Chelsey 2011-11-22
I was worried about the salinities being a vector too but hadn't yet figured out a way around that....Thanks for your input - I'll go back and try again

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Oceanography and Hydrology 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by