這是我的程式碼,不過算出來卻有點怪異,是因為我少注意到哪邊嗎?!
他是一段副程式
[Fortran] 纯文本查看 复制代码 subroutine convertday (yr,mon,day,hr,timeall,dayofyear)
INTEGER :: yr,mon,day,hr,dayofyear
REAL*8 :: timeall
Integer :: DAY_OF_MONTH(12) , Days_Of_Year
DAY_OF_MONTH = (/31,28,31,30,31,30,31,31,30,31,30,31/)
if (MOD(yr,4)==0 .and. MOD(yr,100)/=0) then
DAY_OF_MONTH(2) = 29
Days_Of_Year = 366
else if(MOD(yr,4)==0 .and. MOD(yr,100)==0 .and. MOD(yr,400)==0) then
DAY_OF_MONTH(2) = 29
Days_Of_Year = 366
else !(MOD(yr,4)==0 .and. MOD(yr,100)==0 .and. MOD(yr,400)/=0) then
Days_Of_Year = 365
end if
if ( mon > 1 ) then
dayofyear = day + sum( DAY_OF_MONTH(1:mon-1) )
else
dayofyear = day
end if
timeall = REAL(yr)+(REAL(dayofyear)-0.99)/Days_Of_Year+REAL(hr)/(Days_Of_Year*24)
end subroutine |