How to use m_pcolor and/or pcolorm
20 ビュー (過去 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!