pro nis_c_iof, seq_in, seq_out, sourcedir, header_data, verbose,solflag ; SUB-PROGRAM of nis_proc ; ; ABSTRACT ; Applies IOF conversion. ; ; INPUTS ; seq_in - sequence of corrected spectra from nis_c_rad in radiance units ; sourcedir - source directory for NISCAL programs and data ; verbose - Toggle description of events std output. ; ; OUTPUTS ; seq_out - spectra in 0-1 I over F vlaues. ; ; USES ; nis_qad_solar_spec_convol.dat - This is the per nanometer solar ; IRRADIANCE for each NIS band in Watts/m^2/nm. It is converted to ; RADIANCE by dividing by pi to give W/m^2/sr/nm. The NIS Radiance ; value must have the same units to be meaningful. ; ; HISTORY ; Created 12/03/97 by N. R. Izenberg ; Modified 12/19/97 (NRI) to replace default unity correction with real thing. ; 12/30/97 (NRI) v1.1 directory structure ; 01/19/98 (NRI) v1.2 directory structure ; 03/10/98 (NRI) v1.6 Use solar per nm irradiance and convert ; to radiance ; 07/15/98 (NRI) v2.0 compliant - CNFF format ; 09/18/98 (NRI) Add range sun-target factor from header ; 08/15/00 (NRI) Corrected solar distance scaling error ; (solscale=(targsun/au) needed to be squared) ; 07/22/01 (NRI) v5.0 Compliant (CNISF changes mostly) ; NOTES ; From NIS sequence data: ; IDL columns 1 and 2 define MET high and low word ; CNISF 5.0 column 9 = shutter in/out (0 = in) ; CNISF 5.0 Data is 131:194 for Calibration ; CNISF 5.0 Data is 195:258 for Noise ; IDL column 10 = slit out (0=yes, 1=no) ; IDL column 11 = slit in (0=yes, 1=no) ; ; NOTES ; From NIS sequence data: ; - Per discussion with J. Bell, 12/19/97, the presumed needs for I/F are the ; NIS spectra in units of radiance and the solar irradiance. ; Divide one by t'other and you're done. ; - Make sure units match. We should get a number between zero and 1. ; IOF will need to be normalized by solar distance once spice is available. ; In the meantime, we _could_ use mean solar distance of object. ; -assumption that distance to sun does not change significantly change during ; any one sequence, even one of a few hours duration. ;------------------------------------------------------------------------------ ; Main solflag=0 cal_dir = sourcedir+'lib_tables/' file='nis_solar_spectrum_convol.dat' ; Load in solar irradiance from library. ;-------------------------------------------- sol = fltarr(1,64) openr,unit,cal_dir+file,/get_lun readf,unit,sol close,unit,/all sol=reform(sol) ; (change from column to row format) ;Convert solar irradiance to radiance ; factor 1000 for per Micron sol=(1000.*sol)/!pi ; Go through spectra and divide radiance of each detector by solar radiance ; in that detector range ; Scale to solar distance using s/c location ; scale to target distance using range to target ; Both from sequence header ;-------------------------------------------------------------------------- RngTarg=double(sxpar(header_data,'NEAR-030')) trgx=double(sxpar(header_data,'NEAR-027')) trgy=double(sxpar(header_data,'NEAR-028')) trgz=double(sxpar(header_data,'NEAR-029')) Targsun=sqrt(trgx^2+trgy^2+trgz^2) if targsun eq 0 then targsun=rngtarg ; If target is space or caltarget au=149597870.66d ; If no spice data, targsun and rngtaeg will both be zero. If this is the case ; default to 1 au and flag for history if targsun eq 0 then begin targsun=au solflag=1 endif solscale=(targsun/au)^2 ; scale factor for solar radiance at target. seq_out=seq_in sz=size(seq_in) if sz(0) eq 1 then sz(2)=1 for j = 0, sz(2)-1 do begin seq_out(131:194,j)=seq_in(131:194,j)/(sol/solscale) seq_out(195:258,j)=seq_in(195:258,j)/(sol/solscale) endfor if verbose eq 1 then begin if solflag ne 0 then begin print," >>>> FLAG: No solar distance provided." print," >>>> 1 au dist assumed." endif print,' STEP 9: I over F conversion applied' endif end