[Dart-dev] [3816] DART/trunk/matlab/GetCalendarDate.m: widget to convert a DART date to a Gregorian Calendar Date
nancy at ucar.edu
nancy at ucar.edu
Wed Apr 15 22:04:43 MDT 2009
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090415/996b5af0/attachment.html
-------------- next part --------------
Added: DART/trunk/matlab/GetCalendarDate.m
===================================================================
--- DART/trunk/matlab/GetCalendarDate.m (rev 0)
+++ DART/trunk/matlab/GetCalendarDate.m 2009-04-16 04:04:37 UTC (rev 3816)
@@ -0,0 +1,48 @@
+function h = GetCalendarDate(seconds,days,calendartype)
+%
+% h = GetCalendarDate(seconds,days [,calendartype] )
+%
+% seconds, days are the DART times
+%
+% EXAMPLE:
+%
+% mydate = GetCalendarDate(82761,148520);
+
+% Data Assimilation Research Testbed -- DART
+% Copyright 2004-2007, Data Assimilation Research Section
+% University Corporation for Atmospheric Research
+% Licensed under the GPL -- www.gpl.org/licenses/gpl.html
+%
+% <next few lines under version control, do not edit>
+% $URL:
+% http://subversion.ucar.edu/DAReS/DART/trunk/diagnostics/matlab/fit_ens_mean_time.m
+% $
+% $Id$
+% $Revision$
+% $Date$
+
+if (nargin < 2)
+ error('Must supply at least two arguments, seconds and days')
+elseif (nargin ==2)
+ calendartype = 'Gregorian';
+end
+
+switch lower(calendartype)
+ case 'gregorian'
+ mytime = datenum(1601,1,1) + days + seconds/86400;
+ h = datestr(mytime);
+ disp(sprintf('DART time (%d s, %d d) is %s %s', ...
+ seconds,days,h,calendartype))
+ case 'noleap'
+ error('noleap not supported yet')
+ case 'thirty_day_months'
+ error('thirty_day_months not supported yet')
+ case 'julian'
+ error('julian not supported yet')
+ case 'no_calendar'
+ error('no_calendar not supported yet')
+ case 'gregorian_mars'
+ error('gregorian_mars not supported yet')
+ otherwise
+end
+
Property changes on: DART/trunk/matlab/GetCalendarDate.m
___________________________________________________________________
Name: svn:mime-type
+ text/x-matlab
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
More information about the Dart-dev
mailing list