Is there a fix for a bug in the gshhs function from the MATLAB mapping tool box? Faulty section of coast off South America.
Mostrar comentarios más antiguos
I am creating maps of Antarctica and the surrounding Southern Ocean to show ocean chlorophyll content, so using a polar viewpoint with a stereo map projection and using the current version of MATLAB, MATLAB_R2014a. When using the gshhs function from MATLAB's mapping toolbox to create the coastlines, myself and my supervisor have found a visible fault along South America's East coast and a section of the surrounding waters. This occurs with both the course and low level resolution files, we are yet to try the higher resolutions (they obviously take longer processing times).
Has anyone else come across this before and/or does anyone have a solution to this?
An example of the maps we are producing with the specified problems is attached and the code we used to create it is given below. Any help would be much appreciated.
close all; clear all;
S = netcdf.open('S20060012006031.L3m_MO_SO_Chl_9km.Johnson_SO_Chl.nc4', 'NC_NOWRITE');
% for i = 0:10
% netcdf.inqVar(S,i)
% end
chl = netcdf.getVar(S,0);
lat = netcdf.getVar(S,1);
lon = netcdf.getVar(S,2);
netcdf.close(S);
z = find(lon<0); lon(z) = lon(z)+360;
lon = lon';
for i = 1:720
clon(i,:) = lon;
end
for i = 1:4320
clat(:,i) = lat;
end
z = find(chl <0); chl(z) = NaN; clear z;
chl = double(chl');
% pcolor(lon, lat, log10(chl)); shading flat;
world = gshhs('gshhs_c.b');
h = figure('Color','white')
set(h,'papertype','tabloid')
set(h,'paperposition',[0 0 10 5]); %Gives exactly 2000 x 1000 pixel image
set(h,'InvertHardCopy','off'); %keep set background colors when printing to file
a = axesm('MapProjection','stereo','MapLatLimit',[-90 -30],'MapLonLimit',[0 360],'Frame','on','Grid','off','GLineStyle','-','GLineWidth',1,'MLineLocation',2,'PLineLocation',1,'MeridianLabel','on','ParallelLabel','on','PLabelLocation',[-80:10:-30],'MLabelLocation',[0:30:360],'FontSize',16,'FontWeight','Bold','LabelRotation','on')
set( gca, 'Visible', 'off' ) ;
geoshow([world.Lat], [world.Lon], 'DisplayType','polygon','FaceColor',[0.5 0.5 0.5])
hold on
pcolorm(lat, lon, log10(chl));
Thank you in advance!

Respuesta aceptada
Más respuestas (1)
Kelly Kearney
el 28 de Jul. de 2014
1 voto
Just to clarify, what you're seeing isn't a bug in gshhs so much as a bug in geoshow, patchm, patchesm, etc.; all of Matlab's functions designed to plot polygons on maps seem to fall apart for all but the simplest of polygons. The coast.mat polygons generally pass the test, but no other coastline dataset does so reliably, in my experience.
My usual workaround is to triangulate any patches that I'm planning to plot to a map axis, as I explain in this thread. I've submitted bug reports and enhancement requests related to this over the past 8 or so years, but plotting maps in Matlab still seems to be a bit more of an art than a science.
-Kelly
Categorías
Más información sobre Create Plots on Maps en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
