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

      function filter(w) 1
c
c input:  w       wavelength in microns
c output:         filter functions
c 
c NOTE: "setfilt" must be called before "filter"
c
      parameter (iwvmx=1000)
      common /fltblk/filfun(iwvmx),wmin,wmax,dw,nnf
      if(nnf.eq.0) then 
        filter=1.
      else
        i=(w-wmin)/dw+1.00001
        f=(w-wmin-dw*(i-1))/dw
        if(i.ge.1.and.i.lt.nnf)  then 
          filter=(1.-f)*filfun(i)+f*filfun(i+1)
        else
          filter=0.
        endif
      endif
      return
      end