LLMAP
function [c,hp]=llmap(f,latbox,lonbox,ccc,tit,varargin)
shvalue=[];
landcolor=[];
colmap='gray';
flshad='on';
uvalue =9999;
labelfrequency=5;
contours=1;
cbar='off';
viszero='on';
flover=0;
proj='eqdcylin';
if nargin > 5
for i = 1:length(varargin)
if ischar(varargin{i});
option=varargin{i};
switch option;
case 'flipns'
a=fliplr(a);
case 'flipew'
a=flipud(a);
case 'extshad'
if ischar(varargin{i+1})
switch varargin{i+1};
case 'positive'
shvalue = 0;
disp(' Extreme shading for positive numbers ');
case 'negative'
shvalue = [0 0];
disp(' Extreme shading for negative numbers ');
case 'none'
shvalue = [];
otherwise
disp('Choices are number, positive, negative, none');
error(' llmap --- Wrong choice for extreme shading ');
end
else
shvalue=varargin{i+1};
disp([' Extreme shading with values set to ',sprintf(' %d \n',shvalue)]);
end
case 'colormap'
colmap = varargin{i+1};
colormap(colmap);
disp(sprintf(' Colormap set to %s',colmap));
case 'shading'
flshad=varargin{i+1};
disp(sprintf('Shading is %s ',flshad));
case 'undefvalue'
uvalue=varargin{i+1};
case 'colorbar'
cbar=varargin{i+1};
case 'nocontours'
contours=0; disp(' Not displying contours');
case 'landcolor'
landcolor=varargin{i+1};
case 'label'
labelfrequency=varargin{i+1};
case 'overlay'
flover=1;
case 'projection'
proj=varargin{i+1};
case 'viszero'
viszero=varargin{i+1};
case 'latlabels'
yt=varargin{i+1};
case 'lonlabels'
xt=varargin{i+1};
otherwise
end
end
end
end
[s,a,restype]= makefield(f);
notavalue=find(a == uvalue); a(notavalue)=NaN;
[llon,llat,dlsm]= makeggrid(restype);
b= [a' a(1,:)'];
load coast;
if lonbox(2) - lonbox(1) < 80;
dmerid= [];
else
dmerid=60;
end
if latbox(2) - latbox(1) < 40;
dpar= [];
else
dpar=30;
end
if flover > 0
hold on;
else
axesm (proj,'frame','on','flatlimit',[], ...
'maplatlimit', latbox, 'maplonlimit', lonbox, ...
'parallellabel','on', 'meridianlabel','on',...
'mlinelocation',dmerid,'plinelocation',dpar, ...
'labelformat','compass', ...
'origin',[ 0 mean(lonbox) 0], ...
'grid','on');
setm(gca,'mlabelparallel','s');
setm(gca,'fontname','times');
hold on;
end
title(tit, 'fontsize',12,'fontname','times', 'fontweight', 'bold');
[co]=mkcontour(a,ccc);
if strcmp(flshad,'on')
[c,hp]=contourfm(llat,llon,b,co);
if contours > 0
set(hp,'edgecolor','k');
else
set(hp,'edgecolor','none')
end;
if length(co) > 2; contourcmap(co,colmap);end;
if strcmp(cbar,'on');
hcb=colorbar('horiz','xminortick','on');
end
if labelfrequency > 0
clabelm(c,hp,co(1:labelfrequency:length(co)), ...
'fontsize',8,'fontname','times', 'fontweight', 'bold',...
'rotation',0,'backgroundcolor','none','labelspacing', 200);
end ;
mkcolor(co,shvalue);
if co(1)*co(length(co)) <= 0
ht=cell2mat(get(hp,'cdata'));
set(hp(ht < 0),'linestyle','--');
if strcmp(viszero,'on')
set(hp(ht == 0),'linewidth',1.5);
else
set(hp(ht == 0),'edgecolor','none');
end
end
else
[c,hp]=contourm(llat,llon,b,co);
set(gca,'color','none');
if co(1)*co(length(co)) <= 0
hc=allchild(hp);
ht=cell2mat(get(hc,'userdata'));
set(hc(ht < 0),'linestyle','--');
if strcmp(viszero,'on')
set(hc(ht == 0),'linewidth',1.0);
else
set(hp(ht == 0),'edgecolor','none');
end
end
if labelfrequency > 0
clabelm(c,hp,co(1:labelfrequency:length(co)), ...
'fontsize',8,'fontname','times', 'fontweight', 'bold',...
'rotation',0,'backgroundcolor','none','labelspacing', 200);
end ;
end
if flover < 1
hc=plotm(lat,long,'linewidth',1,'color','black');
if ~isempty(landcolor)
patchesm(lat,long,'facecolor',landcolor);
end
end
tightmap;
hold off;
return;