function []=plotvstat(jdlp,wlp,sp,wind_stress_lp,ilab,iwidth,icol);
% plotvstat(jdlp,wlp,sp,wind_stress_lp,ilab,iwidth,icol);
% ilab=1 to label each stations with stats 
%   (start day relative to whole time period, followed by number
%    of days of good data)
%        % 
%----------- HARD-WIRED "REGION SPECIFIC STUFF"
%  coastline
%
if(exist('ilab')~=1),
   ilab=ones(size(sp(:,1)));
end;   
load coast_sp; 
coast=coast/1000;  %convert to km
nc=length(coast(:,1));
coast(nc+1:nc+3,1)=[180 180 240]';
coast(nc+1:nc+3,2)=[67 240 240]';

% convert stations locations to km
sp=sp/1000;

%
%  40 m isobath
%
load b40_sp;
b40=b40/1000; %convert to km
%
stasize=1;   % 1km boxes
%
%  legend position
%
%
%  cutoff in number of days
%  if less that nday good days of data exist, the stats won't be plotted
%
nday=30;
dt=(jdlp(2)-jdlp(1));
ncut=nday/dt;
%------------END OF HARD-WIRED STUFF-----
%
% convert velocity units to   distance units /TIME(cm/s to km)
% e.g. use to plot velocity arrows as distance stuff would go in one day
 vfac=3600*25/1.e5;   % [cm/s] > km
%
stasize=stasize/2;
boxx=[-stasize stasize stasize -stasize -stasize];
boxy=[-stasize -stasize stasize stasize -stasize];
%
[m,n]=size(wlp);
wlp(:,n+1)=wind_stress_lp*10;

if(exist('iwidth')~=1),
  iwidth=ones(size(n));
  icol=ones(size(n),3);
end
%
iwidth(n+1)=1;
icol(n+1,:)=[1 1 1];
ilab(n+1)=1;

n=n+1;

h=plot(coast(:,1),coast(:,2),'w');...
%hatch(h,[60 3 3],'w');...
h=patch(coast(:,1),coast(:,2),zeros(size(coast(:,1)))-.01,[.8 .8 .8]);
set(h,'edgecolor','none');
line(b40(:,1),b40(:,2),'color','white');...
set(gca,'aspect',[1.3 1]);
set(gca,'tickdir','out');
%  location to plot wind mean and ellipse
wind_sp=[225 115];
sp(n,:)=wind_sp;

ll=[215  95]; %lower left of label box
ur=[245 130]; %upper right
xbox=[ll(1) ur(1) ur(1) ll(1) ll(1)];
ybox=[ll(2) ll(2) ur(2) ur(2) ll(2)];
patch(xbox,ybox,'black');...
line(xbox,ybox,'color','white');
text(ll(1)+2,ur(2)-5,'Wind Stress','color','white','fontsize',8);
xlabel('km');
ylabel('km'); 

axis([215 315 90 180])
%
% legend 
%
[start,stop]=ss2(jdlp);
str1=greg2str(start);
str2=greg2str(stop);
date_str=[str1(1:10) '-' str2(1:10)];

for sta=1:n;
  igood=find(~isnan(wlp(:,sta)));
  z=wlp(igood,sta);
  if(length(z)>ncut),
%  ----station location
   xr=boxx+sp(sta,1);
   yr=boxy+sp(sta,2);
   patch(xr,yr,[1 .5 0]); % orange
%  ----mean vector
   [z1]=arrow(mean(z));;
   xr=real(z1)*vfac+sp(sta,1);
   yr=imag(z1)*vfac+sp(sta,2);
   line(xr,yr,'color',icol(sta,:),'linewidth',iwidth(sta));
%  ----low frequency ellipse
   [z1]=ellplt(z);
   xr=real(z1)*vfac+xr(2);
   yr=imag(z1)*vfac+yr(2);
   line(xr,yr,'color',icol(sta,:),'linewidth',iwidth(sta));
%  ----label station
   if(ilab(sta)==1),
   xlab=max(xr);
   ylab=max(yr);
   text(xlab,ylab,int2str(length(igood)*dt),'fontsize',8);
   end
  end
end
title(date_str);
end
