Azzera filtri
Azzera filtri

How to use m_pcolor and/or pcolorm

27 visualizzazioni (ultimi 30 giorni)
Chelsey
Chelsey il 22 Nov 2011
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?!

Risposte (1)

Kelly Kearney
Kelly Kearney il 22 Nov 2011
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 Commenti
Kelly Kearney
Kelly Kearney il 22 Nov 2011
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 il 22 Nov 2011
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

Accedi per commentare.

Categorie

Scopri di più su Oceanography and Hydrology in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by