c=======================================================================

      subroutine stdaer(iaer,humid) 1
c
c purpose 
c   Replaces data in wlaer,aerext,aerabs,aerasm with standard
c   extinction, absorption, and asymmetry parameters for boundary
c   layer aerosols.  The rural, urban, oceanic or tropospheric
c   aerosols models are interpolated on relative humidity.  
c
c   A similar function is performed by entry USRAER, which fills the
c   same variables with spectral properties of user defined aerosol model

c
c input:
c   iaer      aerosol type 0 = no boundary layer aerosol, causes STDAER
c                              to set wlaer(1)=0.
c                          1 = rural
c                          2 = urban
c                          3 = oceanic
c                          4 = troposheric
c
c   humid    relative humidity at the surface (0.0 - 1.0)
c
      parameter (naerw=47)
      common /extd/ awl(naerw),
     &  rural(naerw,3,4),urban(naerw,3,4),
     &  ocean(naerw,3,4),tropo(naerw,3,4),
     &  bstext(naerw),bstabs(naerw),bstsym(naerw),
     &  avoext(naerw),avoabs(naerw),avosym(naerw),
     &  fvoext(naerw),fvoabs(naerw),fvosym(naerw),
     &  dmeext(naerw),dmeabs(naerw),dmesym(naerw)
      common /aerblk/
     &    wlaer(naerw),aerext(naerw),aerabs(naerw),aerasm(naerw),beta
      dimension rhzone(4)
c
c relative humidity bins:
c 
      data rhzone/0.,.7,.8,.99/ 
      data tiny/.00000001/
c
      if(iaer.eq.0) then
        wlaer(1)=0         ! no boundary layer aerosols
        return
      endif

      beta=0.                       ! angstrom exponent      

      rh=max(0.,min(1.,humid))
      if(rh.lt.rhzone(2)) then
        j=1
      elseif(rh.lt.rhzone(3)) then
        j=2
      else
        j=3
      endif
      
      wt=(rh-rhzone(j))/(rhzone(j+1)-rhzone(j))      
      
      do 20 i=1,naerw
        wlaer(i)=awl(i)
        if(abs(iaer).eq.1) then
          ex1=max(rural(i,1,j),tiny)
          ex2=max(rural(i,1,j+1),tiny)
          ab1=max(rural(i,2,j),tiny)
          ab2=max(rural(i,2,j+1),tiny)
          g1=max(rural(i,3,j),tiny)
          g2=max(rural(i,3,j+1),tiny)
        elseif(abs(iaer).eq.2) then
          ex1=max(urban(i,1,j),tiny)
          ex2=max(urban(i,1,j+1),tiny)
          ab1=max(urban(i,2,j),tiny)
          ab2=max(urban(i,2,j+1),tiny)
          g1=max(urban(i,3,j),tiny)
          g2=max(urban(i,3,j+1),tiny)
        elseif(abs(iaer).eq.3) then
          ex1=max(ocean(i,1,j),tiny)
          ex2=max(ocean(i,1,j+1),tiny)
          ab1=max(ocean(i,2,j),tiny)
          ab2=max(ocean(i,2,j+1),tiny)
          g1=max(ocean(i,3,j),tiny)
          g2=max(ocean(i,3,j+1),tiny)
        elseif(abs(iaer).eq.4) then
          ex1=max(tropo(i,1,j),tiny)
          ex2=max(tropo(i,1,j+1),tiny)
          ab1=max(tropo(i,2,j),tiny)
          ab2=max(tropo(i,2,j+1),tiny)
          g1=max(tropo(i,3,j),tiny)
          g2=max(tropo(i,3,j+1),tiny)
        endif
        if(abs(iaer).ge.1.and.abs(iaer).le.4) then
          aerext(i)=ex1*(ex2/ex1)**wt
          aerabs(i)=ab1*(ab2/ab1)**wt
          aerasm(i)=g1*(g2/g1)**wt
        endif
 20   continue

c        write(*,1000) 'wlaer:',wlaer
c        write(*,1000) 'aerext:',aerext
c        write(*,1000) 'aerabs:',aerabs
c        write(*,1000) 'aerasm:',aerasm
 1000 format(a/1p,5(10e11.3,/))
      return
      end