FUNCTION clv,ldis,lam,mu
;
; Calculation of solar disk intensity at a given distance from the limb
; - or, alternatively at a given heliocentric distance MU -
; according to "Allen's Astrophysical Quantities, 4th ed., 2000, p. 355.
;
; INPUTS: LDIS = distance from the limb in arcsec (disk center = 960)
; ldis can be an array.
; If LDIS < 0 then MU must contain input value(s)
; LAM = wavelength in A
; OUTPUTS: Intensity normalized to disk center (I(960) = 1)
; MU = cos(theta) - heliocentric angle (optional),
; in case of LDIS < 0 used as an input.
; EXAMPLE: i=clv(20,4500,mu)
;
; 1 October 2003, Michal
;
on_error,1
if (ldis lt 0 and n_params() lt 3) or (n_params() lt 2) then $
message,'Usage: i=CLV(limb-dist,lambda [,mu]) or i=CLV(-1,lambda,mu)'
wav=[3500,3700,3800,4000,4500,5000,5500,6000,8000,10000,15000]
u1 =[0.98,1.03,0.92,0.91,0.99,0.97,0.93,0.88,0.73,0.64,0.57]
v1= [0.10,0.16,0.05,0.05,0.17,0.22,0.23,0.23,0.22,0.20,0.21]
mi=min(abs(wav-lam),pos) ;looking for table wavelength
u2=u1(pos) ;finding coefficients
v2=v1(pos)
if ldis ge 0 then mu=sqrt(1-(1-ldis/960.)^2)
ii=1-u2+v2+u2*mu-v2*mu^2
RETURN, ii
END