Files
piscal/dataassim/math/othersupmath/doy_to_monthday.f
T
2016-02-03 18:52:05 +00:00

33 lines
708 B
FortranFixed

subroutine doy_to_monthday(month,monthday,year,idoy)
!extract month,day of month from year and day of year
implicit none
integer month,monthday,year,idoy,isitaleapyear,
&i,j,k,ndays(12)
ndays(1)=31
ndays(2)=28+isitaleapyear(year)
ndays(3)=31
ndays(4)=30
ndays(5)=31
ndays(6)=30
ndays(7)=31
ndays(8)=31
ndays(9)=30
ndays(10)=31
ndays(11)=30
ndays(12)=31
k=0
do i=1,12
do j=1,ndays(i)
k=k+1
if(k.eq.idoy)then
month=i
monthday=j
return
endif
enddo
enddo
month=-9999
monthday=-9999
return
end