/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/greg_0h.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/greg_0h.m

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


Revision 1.1 - (hide annotations) (download)
Thu Oct 21 19:40:15 2010 UTC (14 years, 9 months ago) by gforget
Branch: MAIN
up-to-date matlab codes to process in-situ
data sets to MITgcm/pkg/profiles input format.

1 gforget 1.1 function [gtime]=greg_0h(jourjul)
2     % GREGORIAN Converts Julian day numbers to corresponding Gregorian calendar dates
3     % Formally, Julian days start and end at noon.
4     % In this convention, Julian day 2440000 begins at
5     % 00 hours, May 23, 1968.
6     %
7     % ==========================================
8     % greg_0h.m = contraire de jul_0h.m
9     % ==========================================
10     %
11     % Usage: [gtime]=greg_0h(jourjul)
12     %
13     % jourjul... input decimal Julian day number
14     %
15     % gtime is a six component Gregorian time vector
16     % i.e. gtime=[yyyy mo da hr mi sec]
17     % gtime=[1989 12 6 7 23 23.356]
18     %
19     % yr........ year (e.g., 1979)
20     % mo........ month (1-12)
21     % d........ corresponding Gregorian day (1-31)
22     % h........ decimal hours
23     %
24    
25     % Revised T.Terre
26    
27     %
28     % Ajout TT pour pb de conversion 07 00 00 == retourne en 06 59 60 ?
29     % Ca permet d'avoir la date juste a la dizaine de us pres.
30     % 10/05/2001
31     %
32     fac = 10^9;
33     jourjul= round(fac*jourjul+0.5)/fac;
34    
35     % Fin ajout TT
36    
37     secs=rem(jourjul,1)*24*3600;
38    
39     %
40     % Ajout TT pour pb de conversion 07 00 00 == retourne en 06 59 60 ?
41     % Ca permet d'avoir la date juste a la dizaine de us pres.
42     % 10/05/2001
43     %
44     secs = round(fac*secs + 0.5)/fac;
45    
46     % Fin ajout TT
47    
48     j = floor(jourjul) - 1721119;
49     in = 4*j -1;
50     y = floor(in/146097);
51     j = in - 146097*y;
52     in = floor(j/4);
53     in = 4*in +3;
54     j = floor(in/1461);
55     d = floor(((in - 1461*j) +4)/4);
56     in = 5*d -3;
57     m = floor(in/153);
58     d = floor(((in - 153*m) +5)/5);
59     y = y*100 +j;
60     mo=m-9;
61     yr=y+1;
62     i=(m<10);
63     mo(i)=m(i)+3;
64     yr(i)=y(i);
65    
66     hour=floor(secs/3600);
67     min=floor(rem(secs,3600)/60);
68     sec=rem(secs,60);
69    
70     gtime=[yr(:) mo(:) d(:) hour(:) min(:) sec(:)];

  ViewVC Help
Powered by ViewVC 1.1.22