Contourm issue with polar stereographic map projection

5 vues (au cours des 30 derniers jours)
James
James le 19 Fév 2013
I am having an issue whereby the contours plot fine everywhere except for when they cross the line that switches from 180 degrees longitude to -180 degrees longitude. Here the contours suddenly spike to what appears to be a random place on the map and then return to where they should be on the other side of the longitude line.
I am attempting to plot pressure on a polar stereographic map projection. I have 3 matrices of the same size with the latitude, longitude and pressure data for each location. Here is my code for setting up the map projection. and then I simply plot my data using the contourm function.
maph=axesm('MapProjection','stereo',...
'AngleUnits','degrees',...
'Aspect','normal',...
'FalseNorthing',0,...
'FalseEasting',0,...
'MapLatLimit',sort([0 mult*90]),...
'Geoid',[1 0],...
'Origin',[mult*90 centralmeridian 0],...
'Scalefactor',1,...
'Frame','off',...
'FFill',2000,...
'FLatLimit',[-mult*Inf mult*90],...
'FEdgeColor',gridcolor,...
'FFaceColor','white',...
'FLineWidth',0.25);
contourm(double(latdat),double(londat),double(Tmod),100);

Réponses (1)

Rob Comer
Rob Comer le 5 Mar 2013
There are two ways to specify geometry in contourfm, like this:
contourfm(lat,lon,Z,...)
as you have done, where lat and lon constitute a geolocation mesh. Or like this:
contourfm(Z,R,...)
where R is a referencing object -- see http://www.mathworks.com/help/map/ref/georasterref.html. The first way should be used only for data that are not gridded regularly in latitude-longitude (a satellite swath, for instance). If your data are regularly gridded, such that your latdat and londat could be computed by expanding regularly spaced latitude and longitude vectors with meshgrid (or meshgrat), then try switching to the second way.
You'll need to tell georasterref the size of Tmod (trivial), the latitude and longitude limits of the Tmod grid, and possibly its column and row directions. (Columns run south-to-north by default -- the usual convention for terrain elevation grids, but not for images, and rows run west-to-east by default -- almost always the case.) Lastly, if Tmod include a column of samples on the left at -180 and on the right at +180 (with size(Tmod,2) being almost certainly odd in this case), specify 'RasterInterpretation','postings'. Otherwise, the default, 'cells', would be correct.
The advantages of a referencing object are that (1) it gives contourfm information at a much higher level, which it can put to good use, and (2) it saves a lot of memory. (Perhaps some day contourfm will try to reverse-engineer a referencing object out of whatever geolocation mesh is handed to it, but for now it takes its input more literally.)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by