Home > RPSstuff > mergevec.m

mergevec

PURPOSE ^

MERGEVEC Merges vector data from multiple EPIC time series files

SYNOPSIS ^

function [wi,jd]=mergevec(cdflist,uname,vname,start,stop,dt);

DESCRIPTION ^

 MERGEVEC   Merges vector data from multiple EPIC time series files
             onto a uniform time base (perhaps with gaps)


 Usage: [w,jd]=mergevec(cdflist,uname,vname,start,stop,dt);

      Inputs:  cdflist = array of netcdf file names, one name per row
               uname = character string containing the "east" variable name
                       that you want to contatenate
                       (must be found in all files in CDFLIST)
               vname = character string containing the "north" variable name
               start =  gregorian start time
               stop  =  gregorian stop time
               dt    =  time interval (seconds) for concatenated time series

      Outputs: w = new vector time series with uniform time base (complex)
              jd = corresponding julian day time base

      Example:  [w,jd]=mergevec(  ['file_1.nc '
                                   'file_2.nc '
                                   'file_10.nc'],...
                   'u_1205','v_1206',[1997 4 1 8 0 0],[1998 8 2 0 0 0],3600);

       This merges velocity from three different deployments onto
       a uniform hourly time base beginning at April 1, 1998, 0800 UTC
       and ending August 2, 0000 UTC.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [wi,jd]=mergevec(cdflist,uname,vname,start,stop,dt);
0002 % MERGEVEC   Merges vector data from multiple EPIC time series files
0003 %             onto a uniform time base (perhaps with gaps)
0004 %
0005 %
0006 % Usage: [w,jd]=mergevec(cdflist,uname,vname,start,stop,dt);
0007 %
0008 %      Inputs:  cdflist = array of netcdf file names, one name per row
0009 %               uname = character string containing the "east" variable name
0010 %                       that you want to contatenate
0011 %                       (must be found in all files in CDFLIST)
0012 %               vname = character string containing the "north" variable name
0013 %               start =  gregorian start time
0014 %               stop  =  gregorian stop time
0015 %               dt    =  time interval (seconds) for concatenated time series
0016 %
0017 %      Outputs: w = new vector time series with uniform time base (complex)
0018 %              jd = corresponding julian day time base
0019 %
0020 %      Example:  [w,jd]=mergevec(  ['file_1.nc '
0021 %                                   'file_2.nc '
0022 %                                   'file_10.nc'],...
0023 %                   'u_1205','v_1206',[1997 4 1 8 0 0],[1998 8 2 0 0 0],3600);
0024 %
0025 %       This merges velocity from three different deployments onto
0026 %       a uniform hourly time base beginning at April 1, 1998, 0800 UTC
0027 %       and ending August 2, 0000 UTC.
0028 
0029 %   Rich Signell, USGS  rsignell@usgs.gov  (August 7, 1998)
0030 
0031 jd0=julian(start);
0032 jd1=julian(stop);
0033 % number of points
0034 npts=((jd1-jd0)/(dt/3600/24))+1;
0035 jdi=0:npts-1;
0036 jdi=jdi*dt;     %time in seconds from start
0037 wi=jdi*NaN;
0038 
0039 [m,n]=size(cdflist);
0040 for icdf=1:m,
0041   cdf=cdflist(icdf,:);
0042   ind=min(find(cdf==' '));
0043   if(length(ind)>0),
0044     cdf=cdf(1:ind-1); 
0045   end
0046   cdf
0047   [w,jd]=getvel(cdf,uname,vname,start,stop);
0048   if(isempty(w)==0),
0049 % convert to seconds from start
0050     jd=(jd-jd0)*24*3600;
0051     w=interp_r(jd,w,jdi);
0052     ind=find(~isnan(w));
0053     wi(ind)=w(ind);
0054   end
0055 end
0056 wi=wi(:);
0057 jd=jd0+jdi/3600/24;

Generated on Wed 30-Nov-2005 14:45:02 by m2html © 2003