C*********************************************************************       CALNDR.2     
C*                     SUBROUTINE CALNDR                             *       CALNDR.3     
C*********************************************************************       CALNDR.4     
C                                                                            CALNDR.5     
C--------------------------------------------------------------------        CALNDR.6     
C*  Given the julian day, routine returns month and day as                   CALNDR.7     
C*    character*7 variable. Leap years are ignored.                          CALNDR.8     
C*                                                                           CALNDR.9     
C---------------------------------------------------------------------       CALNDR.10    
C                                                                            CALNDR.11    
C   Declarations.                                                            CALNDR.12    
C   -------------                                                            CALNDR.13    
      SUBROUTINE CALNDR(DOY,MDUM,amfrac)                                     CALNDR.14    
                                                                             CALNDR.15    
      IMPLICIT NONE                                                          Linux_BUGS.1     
                                                                             CALNDR.17    
C Input day number                                                           CALNDR.18    
                                                                             CALNDR.19    
      INTEGER JDAY                                                           CALNDR.20    
      REAL DOY,DAY,GAP,AMFRAC                                                CALNDR.21    
      INTEGER MDUM                                                           CALNDR.22    
                                                                             CALNDR.23    
      CHARACTER*4 MONTH                                                      CALNDR.24    
      CHARACTER*4 MNTH(12)                                                   CALNDR.25    
                                                                             CALNDR.26    
      INTEGER MM, MDAY                                                       CALNDR.27    
      INTEGER NDAY(13)                                                       CALNDR.28    
                                                                             CALNDR.29    
C      DATA NDAY/0,31,59,90,120,151,181,212,243,273,304,334,365/             CALNDR.30    
      DATA NDAY/0,30,60,90,120,150,180,210,240,270,300,330,360/              CALNDR.31    
     :    ,MNTH/'JAN.','FEB.','MAR.','APR.','MAY ','JUNE','JULY',            CALNDR.32    
     :           'AUG.','SEPT','OCT.','NOV.','DEC'/                          CALNDR.33    
                                                                             CALNDR.34    
C   Perform operation.                                                       CALNDR.35    
C   ------------------                                                       CALNDR.36    
                                                                             CALNDR.37    
       DAY=DOY-1.0                                                           CALNDR.38    
      DO 100 MM=12,1,-1                                                      CALNDR.39    
          IF (DAY.GE.(REAL(NDAY(MM+1)+NDAY(MM))/2.0)) THEN                   CALNDR.40    
           MDUM=MM                                                           CALNDR.41    
           GAP=30.0  ! const month length                                    CALNDR.42    
           AMFRAC=(DAY-0.5*REAL(NDAY(MM+1)+NDAY(MM)))/GAP                    CALNDR.43    
           GOTO 200                                                          CALNDR.44    
          ENDIF                                                              CALNDR.45    
  100 CONTINUE                                                               CALNDR.46    
c this means day is between 1-15                                             CALNDR.47    
      MDUM=12                                                                CALNDR.48    
      GAP=30.0                                                               CALNDR.49    
      AMFRAC=(DAY+15.)/GAP                                                   CALNDR.50    
                                                                             CALNDR.51    
  200 CONTINUE                                                               CALNDR.52    
                                                                             CALNDR.53    
      END                                                                    CALNDR.54    
