Warning, /utils/matlab/cs_grid/read_cs/ts2dte.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit 0ebbdffa on 2014-02-15 03:32:06 UTC
ca9e8d0fcf Dimi*0001 function dte=ts2dte(ts,deltat,startyr,startmo,startdy,form)
76bd70de68 Dimi*0002
0ebbdffab8 Dimi*0003 % Function dte=ts2dte(ts,deltat,startyr,startmo,startdy,form)
76bd70de68 Dimi*0004 % convert model time step to a date
0005 %
0006 % INPUTS
0007 % ts time step number
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)
ca9e8d0fcf Dimi*0012 % form format of date ("help datestr" for details)
76bd70de68 Dimi*0013 %
0014 % OUTPUTS
0015 % dte date
0016
ca9e8d0fcf Dimi*0017 if nargin < 6, form=-1; end
76bd70de68 Dimi*0018 if nargin < 5, startdy=1; end
0019 if nargin < 4, startmo=1; end
0020 if nargin < 3, startyr=1992; end
0021 if nargin < 2, deltat=1200; end
0022 if nargin < 1, error('please specify time step number'); end
0023
0ebbdffab8 Dimi*0024 dte=datestr(datenum(startyr,startmo,startdy)+ts*deltat/60/60/24,form);