/[MITgcm]/MITgcm_contrib/gmaze_pv/subfct/dtecco2.m
ViewVC logotype

Contents of /MITgcm_contrib/gmaze_pv/subfct/dtecco2.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Wed Sep 19 15:24:41 2007 UTC (17 years, 10 months ago) by gmaze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -1 lines
General Update

1 % date = dtecco2(X,FORM)
2 %
3 % If:
4 % FORM = 0, translate the stepnum X into a date string (yyyymmddHHMM)
5 % FORM = 1, translate the date string X (yyyymmddHHMM) into a stepnum
6 %
7 % 06/08/29
8 % gmaze@mit.edu
9 %
10
11 function varargout = dtecco2(varargin)
12
13 % Test inputs:
14 if nargin ~= 2
15 help dtecco2.m
16 error('dtecco2.m : Wrong number of parameters');
17 return
18 end %if
19
20 % Recup inputs:
21 X = varargin{1};
22 FORM = varargin{2};
23
24 % New tests:
25 if FORM~=0 & FORM~=1
26 help dtecco2.m
27 error('dtecco2.m : Second argument must be 0 or 1');
28 return
29 elseif FORM == 0 & ~isnumeric(X)
30 help dtecco2.m
31 error('dtecco2.m : if 2nd arg is 0, 1st arg must be numeric');
32 return
33 elseif FORM == 1 & isnumeric(X)
34 help dtecco2.m
35 error('dtecco2.m : if 2nd arg is 1, 1st arg must be a string');
36 return
37 end
38
39
40 % Let's go:
41 switch FORM
42
43 case 0
44 ID = datestr(datenum(1992,1,1)+X*300/60/60/24,'yyyymmddHHMM');
45 varargout(1) = {ID};
46
47 case 1
48 ID = 60*60*24/300*( datenum(X,'yyyymmddHHMM') - datenum(1992,1,1) );
49 varargout(1) = {ID};
50
51
52 end %switch

  ViewVC Help
Powered by ViewVC 1.1.22