function [w]=vecplt2(cdf_names,start,stop);
% VECPLT animates vector currents on a map from BUOY type cdf-files
%  USAGE []=vecplt2(cdf_names,start,stop);
% or
%  USAGE []=vecplt2(cdf_names);
%
if nargin==1,
  [start,stop]=overlap(cdf_names);
end
[m,n]=size(cdf_names);
load harry.ll
load bath.50.ll
%
%%% get velocity data from cdf files
%
for i=1:m
  cdf=cdf_names(i,:);
  lat0(i)=mcagt(cdf,'NC_GLOBAL','latitude');
  lon0(i)=mcagt(cdf,'NC_GLOBAL','longitude');
  w(:,i)=getvlp(cdf,start,stop);
end
%
%%% get runoff data
%
[n,m]=size(w);
cdf='runoff.cdf';
var='merrimack';
[icyc,ncyc]=mctime(cdf,start,stop);
r=mcvgt(cdf,var,icyc,ncyc)/10.;  %daily runoff data
r=interp(r,24);                  %interp to runoff data
w(:,m+1)=r(1:n);
%lat0(m+1)=mcagt(cdf,var,'latitude');
%lon0(m+1)=mcagt(cdf,var,'longitude');
lat0(m+1)=42.7993;
lon0(m+1)=-70.8359;
%% charles is dinky, so turn if off
%var='charles';
%[icyc,ncyc]=mctime(cdf,start,stop);
%r=mcvgt(cdf,var,icyc,ncyc)/10.;
%r=interp(r,24);
%w(:,m+2)=r(1:n);
%mcagt(cdf,var,'latitude');
%mcagt(cdf,var,'longitude');
%lat0(m+2)=42.3936;
%lon0(m+2)=-71.0775;
%
%%% plotting stuff
%
axis('square');
lat_mid=42.3;
lat_max=42.6;
lon_mid=-70.4;
dlon=1.4;
lat_fac=cos(lat_mid*pi/180);
dlat=dlon*lat_fac;
s='y';
while(s~='n')
hold off
axis([lon_mid-.5*dlon lon_mid+.5*dlon lat_mid-.5*dlat lat_mid+.5*dlat]);
plot(harry(:,1),harry(:,2));
title(date_lbl(start,stop));
hold on
plot(bath(:,2),bath(:,1),'r.')
%%%%%
[n,m]=size(w);
i=1;
u=real(w(i,:));
v=imag(w(i,:));
%
% factor for arrows
%
xfac=.01;
yfac=xfac*lat_fac;
arrows(lon0,lat0,u,v,xfac,yfac,'g-');
uold=u;
vold=v;
for i=2:n;
  arrows(lon0,lat0,u,v,xfac,yfac,'i-');
  u=real(w(i,:));
  v=imag(w(i,:));
  arrows(lon0,lat0,u,v,xfac,yfac,'g-');
  uold=u;
  vold=v;
end
s=input('Do it again? [y or n]','s');
end
