Getting errors using contourfm after upgrading to 2013a

1 回表示 (過去 30 日間)
Stuart
Stuart 2013 年 12 月 15 日
回答済み: Simon 2013 年 12 月 19 日
I recently upgraded from Matlab 2009a plus OSX10.6 to Matlab 2013a plus OSX10.9 (on a mid-2009 MacBook Pro). I plot a lot of climate data using the mapping toolbox and contourfm. Since the upgrade contourfm produces strange results, graphics not rendered correctly, overlay contour lines and grids missing etc. The errors are not consistent and sometimes I just get the following error chain:
error using map.graphics.internal.mappolygon>polygonToSimpleCurves (line
305)
Expected at least one polygon part to be clockwise.
Error in map.graphics.internal.mappolygon>multiPatchPolygon (line 178)
[xSimple, ySimple] = polygonToSimpleCurves(x(:), y(:));
Error in map.graphics.internal.mappolygon (line 91)
hPatch = multiPatchPolygon( ...
Error in internal.mapgraph.GeoContourGroup>projectPolygonFaces (line 222)
h = map.graphics.internal.mappolygon(x, y, zdata, pairs{:});
Error in internal.mapgraph.GeoContourGroup/constructFillPolygon (line 122)
hPolygon = projectPolygonFaces(h.HGGroup, S.Lat, S.Lon, zdata,
varargin{:});
Error in internal.mapgraph.ContourGroup/refresh (line 437)
hFill = h.constructFillPolygon(S(k), h.FillZ, props{:},
...
Error in contourm (line 118)
h.refresh()
Error in gs_plot_noline (line 102)
[c,h]= contourm(la,lo,gsd, contourrange,'Fill','on');
I have not changed any of the code since the upgrade, so the error appears to be related to the upgrade. is the problem likely to be with Matlab? OSX10.9? or Java? Any suggestions?
Cheers
Stu
P.S. It is running Java version "1.6.0_65"

回答 (2 件)

Simon
Simon 2013 年 12 月 19 日
Well I confirm that contourfm is still bugged in R2013a . Today I tried but to use yesterday's sample and correct my project so that contourfm would work with R2013a, but failed: see upper row in attached file, with correct output of my code (left) by R2009b and bugged output (right) by R2013a.
Since I have no patience fixing Mathwork's failures, I found a workaround: I am now using pcolorm instead of contourfm : see bottom row, where both plots are made with R2013a but for right plot I explicitly re-gridded (using interp2) from 2.5°x3.75° to a 0.5°x0.5° regular lat-lon mesh. The output is remarkably similar to the original output of contourfm in R2009b.
If you are interested I can post my whole source code (I named my project "gdf_tools"; more output examples at www.copernicus-stratosphere.eu) - be warned though that this is awful spaghetti that will come with no support.

Simon
Simon 2013 年 12 月 18 日
I just encountered the same issues after an upgrade from R2009b to R2013a: no error message in my case, but calls to contourfm which worked just fine in R2009b produce garbage in R2013a - i.e. contourfm is still bugged even after the major bugfix which happened at R2010b (look at release notes for mapping toolbox) .
In any case contourfm was changed in major ways at R2010b with no consideration given to retrocompatibility :-( There are also interactions with other changes, so in a nutshell:
  1. contourfm now requires to set property 'Linestyle' to 'none'
  2. the new function contourcbar replaces colorbar, and the call should be done after controufm
  3. caxis now offsets the colors in a different manner. It seems that it is not necessary any more (?)
  4. coast lines should now be drawn with geoshow rather than plotm
This is illustrated from this sample code which works well and nearly identically in both R200b and R2013a: (adapted from a comparison of "doc contourfm" in both releases):
figure
axesm eckert4; framem; gridm; axis off; tightmap
load geoid
colormap(jet(11)) ;
v = version ;
if str2num( v(1) ) < 8
caxis([-120 100]) ; colorbar
contourfm( geoid, geoidrefvec, -120:20:100 );
else
contourfm( geoid, geoidrefvec, -120:20:100, 'LineStyle', 'none');
contourcbar
end
coast = load('coast');
geoshow(coast.lat, coast.long, 'Color', 'black')
  1 件のコメント
Stuart
Stuart 2013 年 12 月 19 日
Thanks Simon,
I ended up rolling my operating system and Matlab back to 2009; when my current project is finished I will have another go at updating. Are you saying contourfm post R2010b is still buggy? or does the code revision fix the plotting problems?
Cheers Stuart

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by