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

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

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


Revision 1.2 - (hide annotations) (download)
Wed Apr 13 20:51:06 2011 UTC (14 years, 3 months ago) by roquet
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
functions are obsolete. use datestr and datenum instead.

1 gforget 1.1 function [j]=jul_0h(y,m,d,h)
2     % JULIAN Converts Gregorian calendar dates to corresponding
3     % Julian day numbers. Although the formal definition
4     % holds that Julian days start and end at noon, here
5     % Julian days start and end at midnight.
6     %
7     % In this convention, Julian day 2440000 began at 0000 hours, May 23, 1968.
8     %
9     %
10     % Usage: [j]=jul_0h(y,m,d,h) or [j]=jul_0h([y m d hour min sec])
11     % ************************************************************
12     %
13     % d.... day (1-31) component of Gregorian date
14     % m.... month (1-12) component
15     % y.... year (e.g., 1979) component
16     % j.... decimal Julian day number
17     % h.... decimal hours (assumed 0 if absent)
18     %
19     % ************************************************************
20     % recoded for MATLAB by Rich Signell, 5-15-91
21     %
22    
23     % Revised T.Terre 10/05/2001
24    
25     if nargin==3,
26     h=0.;
27     elseif nargin==1,
28     h=y(:,4) + (y(:,5) + y(:,6)/60)/60;
29     d=y(:,3);
30     m=y(:,2);
31     y=y(:,1);
32     end
33     mo=m+9;
34     yr=y-1;
35     i=(m>2);
36     mo(i)=m(i)-3;
37     yr(i)=y(i);
38     c = floor(yr/100);
39     yr = yr - c*100;
40     j = floor((146097*c)/4) + floor((1461*yr)/4) + ...
41     floor((153*mo +2)/5) +d +1721119;
42    
43     % If you want julian days to start and end at noon,
44     % replace the following line with:
45     % j=j+(h-12)/24;
46    
47     %
48     % Ajout TT pour pb de conversion 07 00 00 == retourne en 06 59 60 ?
49     % Ca permet d'avoir la date juste a la dizaine de us pres.
50     % 10/05/2001
51     %
52     fac = 10^9;
53     dh = round(fac*h/24+0.5)/fac;
54    
55     % Fin ajout TT
56    
57     j=j+dh;

  ViewVC Help
Powered by ViewVC 1.1.22