Viewing contents of file '../idllib/astron/contrib/varosi/vlibm/allpro/tau_eff_scat.pro'
;+
; NAME:
;	tau_eff_scat
; PURPOSE:
;	Compute effective optical depth of a sphere including scattering.
; EXPLANATION:
;	Effective optical depth is estimated by interpolating between
;	approximate solutions at large optical depths and small optical depths.
;	Inputs can be scalar or arrays, but must be all same dimensions.
; CALLING:
;	tau_eff = tau_eff_scat( gcos, albedos, taus )
; INPUTS:
;	gcos = average < cos( scattering angle ) >
;	albedos = scattering albedos.
;	taus = optical depths (absorbtion + scattering cross-sections).
; OUTPUTS:
;	Function returns scalar/array of effective optical depths
; HISTORY:
;	Written: Frank Varosi, HSTX @ NASA/GSFC, 1998.
;-

function tau_eff_scat, gcos, albedos, taus

  common tau_eff_scat, method
  common tau_eff_scat1, tscal, tpow, gpow, tfac
  common tau_eff_scat2, tscal2, tpow2, gpow2, apow2

if keyword_set( method ) then begin
	if N_elements( tscal2 ) ne 1 then tscal2 = 15.
	if N_elements( tpow2 ) ne 1 then tpow2 = 1.
	if N_elements( gpow2 ) ne 1 then gpow2 = 1.
	if N_elements( apow2 ) ne 1 then apow2 = 0.4
	ts = tscal2 * albedos^apow2
	qtg = 1 - (1 - exp( -taus^tpow2/ts )) * ( 1 - gcos )^gpow2
 endif else begin
	if N_elements( tscal ) ne 1 then tscal = 2.
	if N_elements( tpow ) ne 1 then tpow = 1.
	if N_elements( tfac ) ne 1 then tfac = 0.5
	if N_elements( gpow ) ne 1 then gpow = 0.5
	qtg = 1 - tfac * (1 - exp( -taus^tpow/tscal )) * ( 1 - gcos )^gpow
  endelse

return, taus * (1 - albedos)^qtg
end