Processing/BrightnessTemperature: lbb.pro

File lbb.pro, 899 bytes (added by peland, 16 years ago)

calculates black body radiance at a given wavelength and temperature

Line
1function lbb,lambda,t
2
3; black body radiance (W/m2/sr/um) at monochromatic wavelength lambda (m) and
4; temperature T (K)
5
6check=check_math()
7if (check and not 32) ne 0 then stop
8;c1=3.741775e-22
9c2=.0143877
10ln_c1_over_pi=-50.48204
11lbb=c2/(lambda*t) ; actually exponent
12over=where(lbb gt 88.8) ; check for overflow
13w=where(lbb le 88.8)
14if over[0] ge 0 then lbb[over]=!values.f_infinity
15if w[0] ge 0 then lbb[w]=exp(lbb[w])-1.
16under=where(lbb lt 1e-45) ; check for underflow
17w=where(lbb ge 1e-45)
18if under[0] ge 0 then lbb[under]=!values.f_infinity ; now ln(lbb)
19if w[0] ge 0 then lbb[w]=ln_c1_over_pi-5.*alog(lambda)-alog(lbb[w])
20under=where(lbb lt -87.3) ; check for underflow
21over=where(lbb gt 88.8) ; check for overflow
22w=where(lbb ge -87.3 and lbb le 88.8)
23if under[0] ge 0 then lbb[under]=0.
24if over[0] ge 0 then lbb[over]=!values.f_infinity
25if w[0] ge 0 then lbb[w]=exp(lbb[w])
26return,lbb
27
28end