function nso_fe_temperature, green, red @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; nso_fe_temperature ; PURPOSE: ; Temperature estimate from ratio of red and green intensity ; CATEGORY: ; NSO ; CALLING SEQUENCE: ; T = nso_fe_temperature, green, red ; INPUTS: ; green array; type: float ; green (Fe XIV) intensity ; red array; type: float ; red (Fe X) intensity ; OUTPUTS: ; T array; type: float ; temperatures (in MK??) ; CALLS: ; BadValue ; PROCEDURE: ; Where both intensity are <= zero no temperature is ; calculated (returned as !values.f_nan) ; The temperature is calculated from ; T = 0.138645-0.0717*alog10(red/green) ; Where only the green intensity is available the temperature ; is set to the maximum temperature Where only the red intensity ; is available the temperature is set to the minimum temperature ; MODIFICATION HISTORY: ; JUL-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- ; Initialize temperature array with NaN T = make_array( /float, dim=size(green, /dim), value=BadValue(0.0) ) i = where(green gt 0 and red gt 0, n) ; Both intensities positive? case i[0] ne -1 of 0: message, /info, 'no valid intensities available' 1: begin T[i] = 0.138645-0.0717*alog10(red[i]/green[i]) Tmax = max( T[i], min=Tmin ) i = where(green gt 0 and red eq 0) ; Only green, set to Tmax if i[0] ne -1 then T[i] = Tmax i = where(green eq 0 and red gt 0) ; Only red, set to Tmin if i[0] ne -1 then T[i] = Tmin i = where(finite(T)) T[i] = 10^T[i] end endcase return, T > 0 & end