C  PASQUILL STABILITY CATEGORY SELECTOR/ TURNER/CGW
      SUBROUTINE STAB (U,IS,IL,IM,ID)
      COMMON SDM(68),SLA,SLO,CC,CH,AE,SD2(21),IHR,SD3(15)
      CHARACTER*1 ISTA,MTC
      CHARACTER*20 ADH
      CHARACTER*3 IMO,IMOT
      DIMENSION AC(4),IST(7,8),ISTA(6),IDC(12),SE(4)
      DIMENSION IMOT(12),SLAT(10),SLOT(10)
      DATA AC/15.,35.,60.,90./
      DATA ISTA/'A','B','C','D','E','F'/
      DATA IST/6,6,4,3,2,1,1,6,6,4,3,2,2,1,6,5,4,4,3,2,1,6,5,4,4,3,2,2,
     15,4,4,4,3,3,2,5,4,4,4,4,3,3,4,4,4,4,4,3,3,4,4,4,4,4,4,3/
      DATA IDC/0,0,3,3,4,4,5,5,5,6,6,7/
      DATA IMOT /'JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG',
     $            'SEP','OCT','NOV','DEC'/
      DATA VE /79.6729/
      DATA SE /92.78,93.64,89.83,89./
      DATA HY /182.62/
      DATA PH /1.570796/
      DATA PI /3.141593/
      DATA P2 /6.283185/
      DATA RD /57.2958/
      DATA SLAT/33.7,40.,39.3,16.7,38.,40.,34.,38.,40.,46./
      DATA SLOT/86.1,113.,76.,169.5,84.,87.5,92.,2*105.,120./
      IF (IL.LT.11) GO TO 30
C     32. STATION LATITUDE AND LONGITUDE
 10   CALL DEF(32,IRT)
      IF (IRT.EQ.0) READ(*,*) SLA,SLO
      GO TO 40
  30  SLA=SLAT(IL)
      SLO=SLOT(IL)
  40  A=SLA/RD
C     33. MONTH,DAY,HOUR (JAN,01,1200)
      CALL DEF(33,IRT)
      IF (IRT.EQ.1) GO TO 80
      READ(*,'(A3,1X,BN,A20)') IMO,ADH
      READ(ADH,'(BN,I2,1X,I4)') ID,IHR
  60  DO 70 IM=1,12
      IF(IMO.EQ.IMOT(IM)) GO TO 80
  70  CONTINUE
      GO TO 40  
C     34. CLOUD COVER (1/10),CLOUD HEIGHT (FT)  
  80  CALL DEF (34,IRT) 
      IF (IRT.EQ.0) READ(*,*) CC,CH 
      HRC=IHR/100.  
      HRS=(HRC-INT(HRC))/0.6+INT(HRC)   
      IF (IM.NE.0) GO TO 100
C     35. SUN ELEVATION ANGLE
      CALL DEF(35,RT)   
      IF (IRT.EQ.0) READ(*,*) AE
      GO TO 130 
 100  DJ=(IM-1)*31-IDC(IM)+ID   
      DV=DJ-VE  
      IF (DV.LT.0.) DV=DV+365.  
      DT=DV 
      DO 110 I=1,4  
      IF (DT.LT.SE(I)) GO TO 120
      DT=DT-SE(I)   
 110  CONTINUE  
 120  DL=SIN(PH*((I-1)+DT/SE(I)))*.4091 
      EQ=(10.*SIN((DV+89.)/HY*P2)+7.75*SIN((DV+78)/HY*PI))/60.  
      HDL=ACOS(-.014538/COS(A)/COS(DL)-(TAN(A)*TAN(DL)))/.2618  
      TC=12.+EQ+(SLO/15.-AINT(SLO/15.)) 
      ISR=(((TC-HDL)-AINT(TC-HDL))*.6+AINT(TC-HDL))*100.
      ISS=(((TC+HDL)-AINT(TC+HDL))*.6+AINT(TC+HDL))*100.
      AE=ASIN(SIN(A)*SIN(DL)+COS(A)*COS(DL)*COS((HRS-TC)*.2618))*RD 
 130  I=0   
      IF (CC.EQ.10.AND.CH.LT.7000.) GO TO 190   
      IF (HRS.GT.(13.-HDL).AND.HRS.LT.(11.+HDL)) GO TO 140  
      I=-2  
      IF (CC.GT.4.) I=-1
      GO TO 190
 140  DO 150 I=1,4
      IF (AE.LT.AC(I)) GO TO 160
 150  CONTINUE
      I=4
 160  IF (CC.LT.6.OR.CH.GT.16000.) GO TO 190
      IF (CC.GT.9.OR.CH.GE.7000.) GO TO 170
      I=I-2
      GO TO 180
 170  I=I-1
 180  IF (I.LT.1) I=1
 190  I=I+3
      J=U+1.
      IF (U.GT.6.) J=8
      IS=IST(I,J)
      MTC=ISTA(IS)
      WRITE(*,200) ISR,ISS,AE,MTC
 200  FORMAT(' SR',I4,3X,' SS',I5,3X,' AE',F6.2,3X,' STAB ',A1)
      RETURN
      END
