pro nis_c_rad, seq_in, seq_out, rad_mode, sourcedir, verbose, flag ; SUB-PROGRAM of nis_proc ; ; ABSTRACT ; Applies radioetric response of to detectors at cal target. ; Converts DN to radiance units; Conversion is: ; Counts / W m^-2 sr^-1 um^-1 or ; DN / W m^-2 sr^-1 um^-1 ; Corrects for slit, since radiometric correction is only derived for narrow ; slit This correciton is mirror position dependent. ; ; INPUTS ; seq_in - sequence of corrected spectra from nis_c_mirror and/or ; nis_c_phot in DN ; rad_mode - select radiometric correction table to be used' ; 0 = Radiative Transfer Model applied to gold sphere, ; APL xtalk, for water/atm removal. ; dn2rad_apl_xtalk_rtmcor.dat ; the corr used for all 5.0 data ; 1 = "Placeholder" for other user-defiend correction ; NOTE - The large calibration sphere probably had adsorbed water. This has ; been propagated as reflectance 'humps' in calibrated Lunar spectra ; at 1400 nm, 980, nm, and possibly at 1900 nm from Earth Swingby. ; Derivation of a correction factor planned. ; sourcedir - source directory for NISCAL programs and data ; verbose - Toggle description of events std output. ; ; OUTPUTS ; seq_out - spectra converted to radiance units. ; ; USES ; nis_dn2rad_coeffs.dat - Radiometric response of the NIS detectors from various ; derivations. initial data table uses ground calibration data ; from APL provided by K. Peacock. These corrections convert from ; DN to radiance in mW/cm^2/sr/um ; They include crosstalk corrections and water band removal ; by radiative transfer modeling. ; nis_W_slit_COR.dat - slit correction for radiometric conversions that ; were only calculated for narrow slit. To get correction ; for the wide slit state the cefficients need to be multiplied ; by the slit correction to get wide DN to radiance coefficients ; ; HISTORY ; Created 10/01/97 by N. R. Izenberg ; Modified 12/04/97 (NRI) for correct conversion table ; 12/30/97 (NRI) v1.1 directory structure ; 01/19/98 (NRI) v1.2 directory structure ; 01/22/98 (NRI) v1.3 rad_mode ; 02/03/98 (NRI) v1.4 W & m^2 instead of mW and cm^2 ; 02/11/98 (NRI) v1.5 fix proper application of slit correction ; 03/10/98 (NRI) v1.6 Another check of radiance units ; 07/15/98 (NRI) v2.0 compliant - CNFF format. Replace outdated ; radiometric corrections with new ones ; 09/15/98 (NRI) Get rid of div by zero if the noise is zero ; 10/01/99 (NRI) v3.5 Clean up options. Add empirical water correction ; 02/21/00 (NRI) v3.95 Add radiative transfer model option. ; 02/28/00 (NRI) v4.0 Add APL Xtlak radiative transfer model option. ; 07/22/01 (NRI) v5.0 Eliminate all rad_mode options other than ; dn2rad_apl_xtalk_rtmcor.dat ; and user-defined placeholder ; Eliminate slit_mode ; 07/22/01 (NRI) v5.0 Compliant ; 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) ;------------------------------------------------------------------------------ ; Main ; Determine slit state ; Read slit state from whole sequence to ; determine the slit correction to be used ;------------------------------------------------------------ slit=seq_in(11,*) ; 0 = slit is IN (Narrow) flag=0 ; Load in LUTs of radiometric conversion of coefficients from library. ;-------------------------------------------------------------------- coefs=fltarr(2,64,10) case rad_mode of 0: filen='nis_dn2rad_coeffs.dat' ; coefficients use APL derived crosstalk correction ; and radiative transfer model removal of laboratory ; water bands 1: filen='nisdn2raduserdefinedcoeffs.dat' ;(dn2rad_const_cornell_xtalk.dat) endcase coefn = fltarr(2,64) openr,unit,sourcedir+'lib_tables/'+filen,/get_lun readf,unit,coefn close,unit,/all coefw = coefn ; If the wide slit is used and the GS derived radiometric correction is used ; it needs to be corrected using a slit correction, since no wide slit ; radiometric correction was derived for it. To do so, use slit_mode to ; determine how to convert. ; Flag if mirror scan goes from below position 150 to above 150. and ; slit_mode =0 ;---------------------------------------------------------------------------- mirror_pos=seq_in(16,*) ; If the slit mode is zero (lab) if total(slit) gt 0 then begin slitcoef=fltarr(64,4) ; Load in table of coefficients from library. ;-------------------------------------------- openr,unit,sourcedir+'lib_tables/nis_w_slit_cor.dat',/get_lun readf,unit,slitcoef close,unit,/all ; for mirror dependent slit correction ;------------------------------------- if min(mirror_pos) le 150 and max(mirror_pos) gt 150 then flag=1 mmm=(mean(mirror_pos) gt 150)*2 coefw(0,*)=coefw(0,*)*slitcoef(*,0+mmm) coefw(1,*)=eprop_mult(coefw(0,*),slitcoef(*,0+mmm), $ coefw(1,*),slitcoef(*,1+mmm)) endif ; now we have 2 coefficient files - coefn and coefw - for all spectra ; Go through spectra and divide DN of each detector by DN/Radiance Unit. ; conversion. Convert noise to radiance units as well. ; Factor of 10 is for conversion to Watts and meters instead of milliwatts ; and centimeters ;-------------------------------------------------------------------------- sz=size(seq_in) if sz(0) eq 1 then sz(2)=1 seq_out = seq_in coefn=coefn/10. coefw=coefw/10. for j = 0, sz(2)-1 do begin ; loop through all spectra if slit(j) eq 0 then fact=coefn else fact=coefw seq_out(131:194,j)=(seq_in(131:194,j)/fact(0,*)) for kk=0,63 do begin seq_out(195+kk,j)=(eprop_div(seq_in(131+kk,j),fact(0,kk), $ seq_in(195+kk,j),fact(1,kk))) endfor endfor if verbose eq 1 then begin print,' >>>> DN to radiance conversion file used : '+filen if flag ne 0 then print,' >>>> FLAG: mirror range not compensated' print,' STEP 8: converted from DN to W m^-2 sr^-1 um^-1' endif return end