Warning, /utils/matlab/cs_grid/read_cs/dte2ts.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit b36d8f68 on 2009-08-02 19:59:36 UTC
b36d8f68af Dimi*0001 function ts=dte2ts(dte,deltat,startyr,startmo,startdy)
0002
0003 % Function ts=dte2ts(dte,deltat,startyr,startmo,startdy)
0004 % convert a date to a model time step
0005 %
0006 % INPUTS
0007 % dte date (e.g., 01-Apr-1997)
0008 % deltat time step length in s (default 1200)
0009 % startyr start year (default 1992)
0010 % startmo start month (default 1)
0011 % startdy start day (default 1)
0012 %
0013 % OUTPUTS
0014 % ts time step number
0015
0016 if nargin < 5, startdy=1; end
0017 if nargin < 4, startmo=1; end
0018 if nargin < 3, startyr=1992; end
0019 if nargin < 2, deltat=1200; end
0020 if nargin < 1, error('please specify a date'); end
0021
0022 ts=(datenum(dte)-datenum(startyr,startmo,startdy))*60*60*24/deltat;
0023