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

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

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


Revision 1.1 - (hide annotations) (download)
Tue Oct 10 19:55:55 2006 UTC (18 years, 9 months ago) by gmaze
Branch: MAIN
update subfct

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

  ViewVC Help
Powered by ViewVC 1.1.22