FUNCTION btemp,in,lam

;Calculation of brightness temperature from normalized intesity
; for a given wavelength.
;INPUT: in - intensity (single value or array) normalized
;		to the mean intensity of quiet photosphere
;	lam - wavelength label. At present, two wavelengths
;		are included: 1 = 15542 A, 2 = 8000 A
;RESULT:  btemp(in,lam) = brightness temperature in K

;Wavelength list: -------------------------------

case lam of
  1: begin
	l=15542.	;wavelength (A)
	b=0.043		;abs. intensity at disk center (W/(cm^2 ster A))
     end
  2: begin
	l=8000.
	b=0.196
    end
  else: begin
	print,'BTEMP: Wavelength not available'
	RETURN,0
    end
endcase

;-------------------------------------------------

c1=1.1903e20		;Planck function constants
c2=1.4384e8

RETURN, c2/l/alog(c1/((l^5)*in*b)+1)

END