Multiple errors while using contourfm
3 views (last 30 days)
Show older comments
I have 2 different variables (indmap19 and indmap20) that I would like to contour in a map. There is no problem when I contour indmap19, but I get multiple errors when I try to contour indmap20. This is very strange because ...
indmap20 = 1 - indmap19;
Here is the code that successfully maps indmap19 (but not indmap20). Both variables are 349 x 277 matrices with numbers varying from 0-1. The latitude (nlat) and longitude (nlon) are from a netcdf data file imported much earlier in the code:
1 figure; ax = usamap({'AZ','CO'});
2 set(ax, 'Visible', 'off')
3 latlim = getm(ax, 'MapLatLimit');
4 lonlim = getm(ax, 'MapLonLimit');
5 states = shaperead('usastatehi',...
'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
6 hold on
7 contourfm(nlat,nlon,indmap19)
8 geoshow(ax, states,'FaceColor','none')
9 title('% season VPD > mean VPD + 1 sigma, 1979-1999')
10 colorbar
11 caxis([0 1])
Here is the (long) list of errors I get when I substitute indmap20 for indmap19 in line 7:
Error using map/private/adjustContourTopology>cornersTraversed
Too many input arguments.
Error in adjustContourTopology>traceSector (line 401)
corners = cornersTraversed(endPosition, E(p).Position);
Error in adjustContourTopology>traceAllSectors (line 346)
[xs, ys, B, tracedForward, tracedBackward] = traceSector(numSectors, ...
Error in adjustContourTopology>analyzeTopology (line 148)
[S, B] = traceAllSectors(x, y, xlimit, ylimit, xmax, ymax);
Error in adjustContourTopology (line 86)
[C, B, S] = analyzeTopology(x, y, xlimit, ylimit, xmax, ymax);
Error in contourIntrinsic>fixTopology (line 365)
[x, y, xp, yp] = adjustContourTopology( ...
Error in contourIntrinsic (line 122)
[L, P] = fixTopology(L, xLimit, yLimit, xmax, ymax);
Error in geocontours (line 138)
[L, P] = contourIntrinsic(Z, levels, R.RasterInterpretation, edgefix);
Error in internal.mapgraph.GeographicContourGroup/getFillPolygons (line 100)
[h.pContourLines, h.pFillPolygons] ...
Error in internal.mapgraph.ContourGroup/refresh (line 434)
S = h.getFillPolygons();
Error in contourm (line 116)
refresh(h)
Error in contourfm (line 36)
contourm(varargin{:},'Fill','on','DefaultLineColor','black');
Thanks so much for your help!
5 Comments
Answers (1)
Chad Greene
on 16 Jul 2015
Strange. I get the same behavior. I will point out that
isequaln(indmap20,1 - indmap19)
ans =
0
meaning indmap20 is not equal to 1-indmap19. That's evident in the number of NaNs in each matrix. But that's not the cause of the problem. I'm not sure what is. Do you need to use contourfm? I generally avoid it because it's so slow and ugly. Will pcolorm suffice?
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!