function [runoff,jd]=getrunoff(cdf,start,stop);
%GETV gets velocity time series from cdf file(s)
%  USAGE 
%     [w,jd]=getv(cdf,start,stop);
%     or
%     [w,jd]=getv(cdf);
% 
%  where: cdf = string containing the name of the cdf file, or a 
%               string array containing the names of multiple cdf files, i.e.
%               cdf=['cdf_file1.cdf'
%                    'cdf_file2.cdf'
%                    'junk.cdf     '];
%         start = [yyyy mm dd hh mi sc];
%         stop  = [yyyy mm dd hh mi sc];
%
%    if start and stop are missing, then the series overlapping in time are 
%     returned.  U and V must be var1 and var2 in cdf file.
%
%         jd = julian day 
%
var1='merrimack';
%
if nargin==1,
   [start,stop]=mcgtim(cdf);    %get whole file if no time
   [icyc,ncyc,jd]=mctime(cdf,start,stop);
   runoff=mcvgt(cdf,var1,icyc,ncyc);
else
   jd1=julian(start); start=gregorian(jd1-1);
   jd2=julian(stop);  stop=gregorian(jd2+1);
   [icyc,ncyc,jd]=mctime(cdf,start,stop);
   delt=(jd(2)-jd(1))/24;
   runoff=mcvgt(cdf,var1,icyc,ncyc);
   i0=(jd1-jd(1))/delt+1;
   nt=round((jd2-jd1)/delt)+1;
   ind=[max(i0,1):min(i0+nt-1,ncyc)];
   runoff=runoff(ind);
   jd=jd(ind);
end
