      subroutine julian2(jd,yr,mn,dy)
c
c*    input: jd .... julian day
c            yr .... year
c*    output: mn .... month
c             dy .... day
c
      integer yr,mn,dy,jd
      integer leap,cumulday(12,2)

      data cumulday/31,59,90,120,151,181,212,243,273,304,334,365,
     .              31,60,91,121,152,182,213,244,274,305,335,366/
c
c*     is it leap year?
c
      IF ((MOD(YR,4) .EQ. 0 .AND. MOD(YR,100) .NE. 0)
     .     .OR. MOD(YR,400) .EQ. 0 ) THEN
         LEAP = 2
      else
         leap = 1
      endif
c
c*  Julian day 
c
      do m=1,12
         jd_tmp=cumulday(m,leap)
         if(jd_tmp .ge. jd) then
            mn=m
            if(mn.eq.1) then
               dy=jd
            else
               dy=(cumulday(m,leap)-cumulday(m-1,leap))-(jd_tmp-jd)
            endif
            goto 99
         endif
      enddo
 99   return
      end
