Changeset 2461 in lmdz_wrf
- Timestamp:
- Apr 23, 2019, 3:26:30 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2460 r2461 138 138 # IsNumber: Function to determine if a given String is a given type of number 139 139 # join_NOstrlist: Function to join a non-string list of values 140 # julday_360d: Function to provide the julian day of a date in a 360 days/yr (or 12 30-days months) calendar 140 # julday_360d: Function to provide the julian day of a date in a 360 days/yr (or 12 141 # 30-days months) calendar 142 # juliandate: Function to provide the julian date (in days since -4712 January 1st 00 UTC) 143 # for any greogiran date 141 144 # latex_fig_array: Function to add an array of figures to an existing tex file 142 145 # latex_text: Function to transform a text to LaTeX following style rules … … 15842 15845 15843 15846 def juliandate(yr,mo,dd,hr,mi,ss): 15844 """ Function to provide the julian date (in days) for a date between 1801 and 2099 15847 """ Function to provide the julian date (in days since -4712 January 1st 00 UTC) 15848 for any greogiran date 15845 15849 refdate: 1 January 4713 BC (= -4712 January 1), Greenwich mean noon (= 12h UT). 15846 15850 FROM: https://aa.usno.navy.mil/faq/docs/JD_Formula.php 15847 15851 after 1990 edition of the U.S. Naval Observatory's Almanac for Computers 15852 >>> juliandate(1877,8,11,7,30,0) 15853 2406843.3125 15854 >>> juliandate(877,8,11,7,30,0) 15855 2041601.3125 15856 >>> juliandate(1970,1,1,0,0,0) 15857 2440588.0 15848 15858 >>> juliandate(1978,1,1,0,0,0) 15849 15859 2443510.0 15850 15860 >>> juliandate(1978,7,21,15,0,0) 15851 15861 2443712.625 15852 15862 """ 15853 15863 fname = 'juliandate' 15854 15864 15855 K = dd 15856 I = yr 15857 J = mo 15858 UT = hr + mi/60. + ss/3600. 15859 15860 sec1 = 367.*K 15861 sec2 = int((7.*(K+int((M+9)/12.)))/4) 15862 sec3 = int((275.*M)/9.) 15863 sec4 = I 15864 sec5 = 1721013.5 15865 sec6 = UT/24. 15866 sec7 = 0.5*sign(100.*K+M-190002.5) 15867 15868 juliand = int(dd - 32075. + 1461.*(yr+4800.+(mo-14)/12.)/4. + \ 15869 367.*(mo-2-(mo-14)/12.*12)/12. - 3*((yr+4900+(mo-14)/12.)/100.)/4.) 15870 15871 JD= K-32075+1461*(I+4800+(J-14)/12)/4+367*(J-2-(J-14)/12*12) \ 15872 /12-3*((I+4900+(J-14)/12)/100)/4 15873 15874 print yr,mo,dd,hr,mi,ss,' JD:', JD 15875 15876 # juliand = juliand + hr/24. + mi/(24.*60.) + ss/(24.*3600.) 15865 sec1 = dd - 32075. 15866 sec2 = 1461.*(yr+4800.+(mo-14)/12.)/4. 15867 sec3 = 367.*(mo-2-(mo-14)/12.*12)/12. 15868 sec4 = 3.*((yr+4900.+(mo-14.)/12.)/100.)/4. 15869 15870 juliand = int(sec1 + sec2 + sec3 - sec4) 15871 15872 juliand = juliand*1. + (hr + mi/60. + ss/3600.)/24. 15873 15874 # Alternative (without full agreement, just kept in case) 15875 #K = yr + 0 15876 #M = mo + 0 15877 #I = dd + 0 15878 #UT = hr*1. + mi/60. + ss/3600. 15879 15880 #sec1 = 367.*K 15881 #sec2 = int((7.*(K+int((M+9)/12.)))/4.) 15882 #sec3 = int((275.*M)/9.) 15883 #sec4 = I*1. 15884 #sec5 = 1721013.5 15885 #sec6 = UT/24. 15886 #sec7 = 0.5*sign(100.*K+M*1.-190002.5) 15887 #sec8 = 0.5 15888 15889 #juliand = sec1 - sec2 + sec3 + sec4 + sec5 + sec6 - sec7 + sec8 15890 #print ' juliand:', juliand 15877 15891 15878 15892 return juliand 15879 print juliandate(1877,8,11,7,30,0)15880 15881 print juliandate(1970,1,1,0,0,0)15882 15883 print juliandate(1978,1,1,0,0,0)15884 15885 print juliandate(1978,7,21,15,0,0)15886 quit()15887 15893 15888 15894 def fix_CFdates(timevals, origcftimeu, origcal, \
Note: See TracChangeset
for help on using the changeset viewer.