subroutine yd_to_ymd(idn,iy,im,id) implicit none integer idn,iy,im,id,i,ly,mosum integer molens(12) data molens/31,28,31,30,31,30,31,31,30,31,30,31/ c c subroutine returns the month (m) and day of month (d) given the c year (y) and day in year (dn). c ly=0 if(mod(iy,4).eq.0 .and. + (mod(iy,100).ne.0 .or. mod(iy,400).eq.0) )ly=1 molens(2)=28+ly im=1 mosum=0 id=idn do i=1,12 mosum=mosum+molens(i) if(idn.gt.mosum)then id=idn-mosum im=i+1 endif enddo return end