MESSENGER MASCS UVVS-VIRS DDR TO COMBINED DDR PROCEDURES Version 1, 3/22/2017 Document Change History Version 1, 3/22/2017, C. Mauceri, ACT Version submitted for first DDR delivery (PDS Delivery 16). MASCS UVVS-VIRS DDR to COMBINED DDR pseudocode. This document describes high level "pseudocode" and tables which define the procedures used to combine MASCS UVVS Derived Data Records (DDRs) and MASCS VIRS Derived Data Records (DDRs). This pseudocode follows logic and language structures that make it easily adaptable to a number of programming languages, but is not considered to be functional code in and of itself. It will be updated by the MASCS team as the calibrations are refined, but it is not supported, deliverable code. The PROCEDURES that are included; ;----------------------------------------------------------------------------- ; * uvvisddrmaker3 - make joint UVVS and VIRS file. ;----------------------------------------------------------------------------- ;***************************************************************************** ; P R O C E D U R E S ;***************************************************************************** ;----------------------------------------------------------------------------- ; * uvvisddrmaker3 - make joint UVVS and VIRS file. ;----------------------------------------------------------------------------- pro uvvisddrmaker3, dir=dir, listfile = listfile, output=output, user=user ; Procedure to make joint UVVS and VIRS file. ; Loads UVVS HDR, SCI, and VIRS VIS and NIR files for basic and derived info ; Creates new structure of "Information product" ; writes file under new filename - annotated by the UVVS acquisition time. ; ; Initialized 7/18/2106 by Noam Izenberg ; Modified by: 7/20/2016 by Calogero Mauceri to run on APL processing machine ; Modified 7/22/2016 by NRI after PDS discussion with Lyle and Susie and Jenn Also modified to match model FMT file from Calogero ; Added some csv and plotting output (commented out) ; Modified 2/10/2017 by NRIto add qualitative UVVS footprint DQI evaluation and digest altvirs lists. ; Modified 3/1/2017 by CM for faster files lookup at APL. Added user keyword for switching base paths lookups ; ; Input info is the YYDOY_HHMMSS unique time-based part of both the UVVS and VIRS file ; ; Components of the Information File ; ;1. UVVS Header File ID (from file list or lable) (string) ;2. UVVS Science File ID (from file list or lable) (string) ;3. VIRS VIS File ID (from file list or lable) (string) ;4. VIRS NIR File ID (from file list or lable) (string) ;5. VIRS Spectrum Number (derived/selected by automated/human matching) (int) ;6. UVVS drift Distance in km from first to last step (derived from UVVS SCI DDR) (float) ;7. UVVS smear as a % of footprint size (derived from UVVS SCI DDR) (float) ;8. Lat, Lon cords of UVVS spectral footprints (center and 4 corners - C0, C1, C2, C3, C4 Copied from UVVS SCI DDR) (5 fields, each 46 float) ; Lat Center (C0) ; Lat Corner 1 (C1) ; Lat Corner 2 (C2) ; Lat Corner 3 (C3) ; Lat Corner 4 (C4) ; Lon Center (C0) ; Lon Corner 1 (C1) ; Lon Corner 2 (C2) ; Lon Corner 3 (C3) ; Lon Corner 4 (C4) ;9. Lat, Lon cords of VIRS spectral footprint (center, and pointds describing the VIRS ovoid - C0, C1, C2, C3, C4 Copied from VIRS DDR) (2 fields, each 5xfloat) ; Lat cords ; Lon coords ;10. Distance in km from center cords of UVVS to center cords of VIRS (Derived from UVVS SCI DDR and VIRS DDR) (float) ;11. Distance % of footprint size from center cords of UVVS to center cords of VIRS (Derived from UVVS SCI DDR and VIRS DDR) (float) ;12. Average I, e, phase UVVS (copied from UVVS SCI DDR of central wavelength) (3xfloat) ;13. Average I, e, phase VIRS (copied from VIRS DDR) (3xfloat) ;14. "Goodness of Match" (derived from UVVS and VIRS DDR (photometrically corrected) reflectance at 300 nm -> (VIRS reflectance at 300 nm / UVVS reflectance at 300 nm)- 1.00 being perfect match) (float) ;15. DQI (int or 4xbinary, or as appropriate) ;a. Hot UVVS (threshold) (derived from UVVS SCI DDR) ;b. Hot VIRS (threshold) (derived from VIRS DDR) ;c. "AltVIRS (0/1) (derived/selected by automated/human matching) ;d. Secondary AltVIRS (not closest, but best) (0/1) (selected by human matching) ;e VIRS Binning (0 for no. 1 for yes, binned by 2) ;f landscape variability. Qualitative analysis of variability within UVVS footprint 1=low, 2=medium, 3=high ;g Spare ;16. Wavelength file of combined spectrum: 46 UVVS wavelengths, 494 VIRS wavelengths (approx. 540xFloat) ;17. Photometrically corrected reflectance values of combined spectrum: 46 UVVS wavelengths, 494 VIRS wavelengths (approx. 540xFloat) ;18. Photometrically corrected reflectance noise of combined spectrum: 46 UVVS wavelengths, 494 VIRS wavelengths (approx. 540xFloat) ;19. 4xSpare (float) ; Inputs: ; UVVSfile - list of UVVS filenames in 'YYDOY_HHMMDD' format - can be single file ; VIRSfile - list of VIRS filenames in 'YYDOY_HHMMDD' format - can be single file - must be equal in number to UVVSfile ; vspecnums - list of virs spectrum numbers for the VIRS spectra. ; altv - toggles if there is alternative virs. A value of 0 = contemporaneous (default) 1 = "closest" altvirs. A value of 2 = "best but not closest. ; vari =vari input for qualitative surface variability DQI ; output= output array of combined DDR structures ; user (keyword) = 'ACT' or 'Noam'. If it is not set then it defaults to 'Noam' ;TEST SETUP====================== patch=2. ; VIRS photometric patch. Change this to 1, or get rid of patch, when VIRS photmetric correction is updated. ;patch=1. ; Unsing NCE VIRS DDRs (02/23/17) ;TEST SETUP====================== ;Reading in the list file and creating the necessary variables if n_elements(dir) eq 0 then dir='/Users/izenbnr1/Documents/Work/MESSENGER/MESSENGER_NCE/UVVSVIRS_tables/' if n_elements(listfile) eq 0 then listfile='complete_list_with_matches.csv' if not keyword_set(user) then begin user = 'Noam' endif test1=read_csv(dir+listfile) UVVSfile=test1.field01 ;UVVSfile name altv = 2*(test1.field11 eq "yes") ;altvirs used? VIRSAuto=test1.field02 ; If VIRS was autoselected autospecnums = test1.field03 ;VIRS sepcnum if autoselected VIRSHand=test1.field13 ; If VIRS was hand-selected handspecnums = test1.field14 ;VIRS sepcnum if hand selected VIRSfile=VIRSAuto VIRsFile[where(VIRShand ne '')] = VIRSHand[where(VIRShand ne '')] ;VIRSfile vspecnums=autospecnums vspecnums[where(VIRShand ne '')] = handspecnums[where(VIRShand ne '')] ;vspecnums vari = test1.field08 ; landscape variability for DQI ; variability DQI ; Initialize combined DDR TPLT = { $ UVVS_HEADER_FILE_ID : strarr(1) ,$ UVVS_SCIENCE_FILE_ID : strarr(1) ,$ VIRS_VIS_FILE_ID : strarr(1) ,$ VIRS_NIR_FILE_ID : strarr(1) ,$ VIRS_SPECTRUM_NUMBER : intarr(1) ,$ UVVS_DRIFT : dblarr(1) ,$ UVVS_SMEAR : dblarr(1) ,$ UVVS_TARGET_LATITUDE_C0 : dblarr(46) ,$ UVVS_TARGET_LATITUDE_C1 : dblarr(46) ,$ UVVS_TARGET_LATITUDE_C2 : dblarr(46) ,$ UVVS_TARGET_LATITUDE_C3 : dblarr(46) ,$ UVVS_TARGET_LATITUDE_C4 : dblarr(46) ,$ UVVS_TARGET_LONGITUDE_C0 : dblarr(46) ,$ UVVS_TARGET_LONGITUDE_C1 : dblarr(46) ,$ UVVS_TARGET_LONGITUDE_C2 : dblarr(46) ,$ UVVS_TARGET_LONGITUDE_C3 : dblarr(46) ,$ UVVS_TARGET_LONGITUDE_C4 : dblarr(46) ,$ VIRS_TARGET_LATITUDE_SET : dblarr(5) ,$ VIRS_TARGET_LONGITUDE_SET : dblarr(5) ,$ VIRS_UVVS_CENTER_DISTANCE : dblarr(1) ,$ VIRS_UVVS_OFFSET_PERCENTAGE : dblarr(1) ,$ UVVS_CENTER_PHOT_ANGLES : dblarr(3) ,$ VIRS_CENTER_PHOT_ANGLES : dblarr(3) ,$ VIRS_UVVS_MATCH : fltarr(1) ,$ DQI : strarr(7) ,$ FULLSPEC_WAVELENGTHS : fltarr(540) ,$ FULLSPEC_PHOTOM_IOF_DATA : fltarr(540) ,$ FULLSPEC_PHOTOM_IOF_NOISE_DATA : fltarr(540) ,$ SPARE_1 : fltarr(1) ,$ SPARE_2 : fltarr(1) ,$ SPARE_3 : fltarr(1) ,$ SPARE_4 : fltarr(1) } output=replicate(tplt,n_elements(UVVSfile)) ;-- altv=intarr(n_elements(VIRSFILE)) ; Load in UVVS and VIRS from the filenames ; if n_elements (UVVSfile) ne n_elements(VIRSfile) then begin Print, "Unequal number of UVVS and VIRS input files" return endif ; We want reprocessed UVVS data, and reprocessed VIRS data _EXCEPT_ for the VIS channel, ; so we load in both the old and new VIRS files. ; take NIR and pointing etc data from the NEW VIRS files, but the VIS reflectance and noise ; from the old print,'user: ',user case user of 'Noam': begin ;UVVSbasedir='/Users/izenbnr1/Documents/Work/MESSENGER/MASCS_DATA/DDR/UVVS/UVVS_SURFACE/*/MUV/' ;VIRSbasedir='/Users/izenbnr1/Documents/Work/MESSENGER/MASCS_DATA/DDR/*/*/*/*/' ;VIRSOLDbasedir='/Users/izenbnr1/Documents/Work/MESSENGER/MASCS_DATA/DDROLD/*/*/*/*/' outdir ='/Users/izenbnr1/Documents/Work/MESSENGER/MASCS_DATA/UVVS_VIRS_Combined/' end 'ACT': begin ; for APL UVVSbasedir='//sd-mess-uvvs/pipe_uvvs/cdr_rdr_products/mascs/data/DDR/' VIRSbasedir='E:/pipe_virs/cdr_rdr_products/mascs/data/DDR/' VIRSOLDbasedir='E:/pipe_virs/cdr_rdr_products/mascs/data/backup/DDR_pds15/' end else: begin print, 'unknown user' stop end endcase iii=0 for iii=0,n_elements(UVVSfile)-1,1 do begin ;; commented out for test print,iii ufile=UVVSfile[iii] vfile=VIRSfile[iii] ofile=VIRSfile[iii] ;read in UVVS HDR and Science files, and VIRS VIS and NIR files - all DDRs) ;initialize lookup paths hdr_filename = 'UMD_'+ ufile + '_HDR.DAT' sci_filename = 'UMD_'+ ufile + '_SCI.DAT' vis_filename = 'VIRSVD_' + vfile + '.DAT' nir_filename = 'VIRSND_' + vfile + '.DAT' case user of 'Noam': begin ; UVVS uvvs_hdr_filepath = UVVSbasedir + hdr_filename uvvs_sci_filepath = UVVSbasedir + sci_filename ; VIRS virs_vis_filepath = VIRSbasedir + vis_filename virs_nir_filepath = VIRSbasedir + nir_filename virs_vis_old_filepath = VIRSOLDbasedir + vis_filename virs_nir_old_filepath = vVIRSOLDbasedir + nir_filename end 'ACT': begin ; UVVS ;UVVS filename is something like OB3_49_14040_165240 ; get mission phase name uvvs_mission_phase = strmid(ufile, 0, 3) UVVSbasedir_mission = UVVSbasedir + uvvs_mission_phase + '/UVVS_SURFACE/*/MUV/' uvvs_hdr_filepath = UVVSbasedir_mission + hdr_filename uvvs_sci_filepath = UVVSbasedir_mission + sci_filename ; VIRS ;initialize VIRS lookup paths ;VIRS filename is something like OB4_15075_205331 ; get mission phase name virs_mission_phase = strmid(vfile, 0, 3) virs_filepath = VIRSbasedir + virs_mission_phase + '/VIRS/*/' virs_vis_filepath = virs_filepath + 'VIS/' + vis_filename virs_nir_filepath = virs_filepath + 'NIR/' + nir_filename virs_old_filepath = VIRSOLDbasedir + virs_mission_phase + '/VIRS/*/' virs_vis_old_filepath = virs_old_filepath + 'VIS/' + vis_filename virs_nir_old_filepath = virs_old_filepath + 'NIR/' + nir_filename end endcase print,'Looking for UVVS HDR file...',uvvs_hdr_filepath uvhdrfile=file_search(uvvs_hdr_filepath, COUNT=nf) if (nf eq 0) then begin print, 'Could not find any file. Done processing.' return endif else begin print,'found file '+uvhdrfile endelse print,'Looking for UVVS SCI file...', uvvs_sci_filepath uvscifile=file_search(uvvs_sci_filepath, COUNT=nf) if (nf eq 0) then begin print, 'Could not find any file. Done processing.' return endif else begin print,'found file '+uvscifile endelse print,'Looking for VIRS VIS file...',virs_vis_filepath vivisfile=file_search(virs_vis_filepath, COUNT=nf) if (nf eq 0) then begin print, 'Could not find any file. Done processing.' return endif else begin print,'found file '+vivisfile endelse print,'Looking for VIRS NIR file...',virs_nir_filepath vinirfile=file_search(virs_nir_filepath, COUNT=nf) if (nf eq 0) then begin print, 'Could not find any file. Done processing.' return endif else begin print,'found file '+vinirfile endelse print,'Looking for OLD VIRS VIS file...',virs_vis_old_filepath oldvivisfile=file_search(virs_vis_old_filepath, COUNT=nf) if (nf eq 0) then begin print, 'Could not find any file. Done processing.' return endif else begin print,'found file '+oldvivisfile endelse print,'Looking for OLD VIRS NIR file...',virs_nir_old_filepath oldvinirfile=file_search(virs_nir_old_filepath, COUNT=nf) if (nf eq 0) then begin print, 'Could not find any file. Done processing.' return endif else begin print,'found file '+oldvinirfile endelse uvh = read_mascs_ddr(uvhdrfile) uvs = read_mascs_ddr(uvscifile) vis = read_mascs_ddr(vivisfile) nir = read_mascs_ddr(vinirfile) oldvis = read_mascs_ddr(oldvivisfile) oldnir = read_mascs_ddr(oldvinirfile) ; don't acutally use this, but we have it in the procedure. ;Calculate UVVS drift Distance km and smear % of footprint ;================================ ulats = uvs.TARGET_LATITUDE_SET ;8. Lat, Lon cords of UVVS spectral footprints (center and 4 corners - C0, C1, C2, C3, C4 Copied from UVVS SCI DDR) (5x46float) ulons = uvs.TARGET_LONGITUDE_SET ;centers of all footrprint culats = reform(ulats[0,*],46) culons = reform(ulons[0,*],46) ;corners c1lats = reform(ulats[1,*],46) c1lons = reform(ulons[1,*],46) c2lats = reform(ulats[2,*],46) c2lons = reform(ulons[2,*],46) c3lats = reform(ulats[3,*],46) c3lons = reform(ulons[3,*],46) c4lats = reform(ulats[4,*],46) c4lons = reform(ulons[4,*],46) ;center of center wavelenthg footprint cculat=culats[23] cculon=culons[23] leg1lat = ulats[1:2,23] leg2lat = ulats[2:3,23] leg1lon = ulons[1:2,23] leg2lon = ulons[2:3,23] ;drift in km R=2439400. ;meters drift=map_2points(culons[0],culats[0],culons[45],culats[45],radius=R)/1000. leg1=map_2points(leg1lon[0],leg1lat[0],leg1lon[1],leg1lat[1],radius=R)/1000. leg2=map_2points(leg2lon[0],leg2lat[0],leg2lon[1],leg2lat[1],radius=R)/1000. meanleg=(leg1+leg2)/2. ;smear as a % of footprint size (average of 2 sides of the footprint) smear=drift/meanleg ; Calculate Center UVVS to Center VIRS distance km ;================================ vlats = vis.TARGET_LATITUDE_SET ;9. Lat, Lon cords of VIRS spectral footprint (center, and pointds describing the VIRS ovoid - C0, C1, C2, C3, C4 Copied from VIRS DDR) (5xfloat) vlons = vis.TARGET_LONGITUDE_SET vspeclat=vlats[*,vspecnums[iii]] vspeclon=vlons[*,vspecnums[iii]] vclat = vlats[0,vspecnums[iii]] vclon = vlons[0,vspecnums[iii]] UVVISDIST = map_2points(cculon,cculat,vclon,vclat,radius=R)/1000. ; Calculate Center UVVS to Center VIRS distance % of UVVS footprint ;================================ offset = uvvisdist/meanleg ; get UVVS center i, e, a ;================================ ui=uvs.incidence_angle ue=uvs.emission_angle ua=uvs.phase_angle uphot=[ui[23],ue[23],ua[23]] ; get VIRS center i, e, a ;================================ vi=VIS.incidence_angle ve=VIS.emission_angle va=VIS.phase_angle vphot=[vi[vspecnums[iii]],ve[vspecnums[iii]],va[vspecnums[iii]]] ; Create DQI ;================================ PT = uvs.PMT_TEMPERATURE If PT[23] gt 50 then HotUVVS = '1' else HotUVVS = '0' NT = NIR.TEMP_2 If NT[vspecnums[iii]] gt 35 then HotVIRS = '1' else HotVIRS = '0' ; altvirs ( none = 0,0; altvirs = 1,0 ; best but not closest = 1,1 DQI3 = '1' DQI4 = '0' case altv[iii] of 0: DQI3 = '0' 1: 2: DQI4 = '1' endcase if n_elements(vari) eq 0 then variability = '0' else variability = STRTRIM(vari[iii], 2) vbin=mean(vis.binning) nbin=mean(vis.binning) if vbin ne 1 then VIRSbinning = '1' else VIRSbinning = '0' ; Create contatenated wavelength vector ;================================ wluv = uvs.bin_wavelength wlvis1=vis.channel_wavelengths wlnir1=nir.channel_wavelengths pv1=findndx(wlvis1[*,0],301) pv2=findndx(wlvis1[*,0],895) nv2=findndx(wlnir1[*,0],1450) wlvis=wlvis1[pv1:pv2,0] wlnir=wlnir1[0:nv2,0] ;FIX IF LOW VIS WVLN IS TOO LOW if (wlvis[0] lt 300) and (n_elements(wlvis)/2 ne n_elements(wlvis)/2.) then begin wlvis=wlvis[1:*] pv1=pv1+1 endif if (n_elements(wlvis) eq 257) then begin wlvis=wlvis[0:255] pv2=pv2-1 endif ; Create contatenated spectrum ;================================ uvdata = uvs.PHOTOM_IOF_BIN_DATA uvnoiz = uvs.PHOTOM_IOF_BIN_NOISE_DATA visdata1 = oldvis.PHOTOM_IOF_SPECTRUM_DATA nirdata1 = nir.PHOTOM_IOF_SPECTRUM_DATA visnoiz1 = oldvis.PHOTOM_IOF_NOISE_SPECTRUM_DATA ; this is where old vis reflectance is used nirnoiz1 = nir.PHOTOM_IOF_NOISE_SPECTRUM_DATA visdata = visdata1[pv1:pv2,vspecnums[iii]]/patch ; this is where old vis photometric factor of 2 error is fixed. nirdata = nirdata1[0:nv2,vspecnums[iii]] visnoiz = visnoiz1[pv1:pv2,vspecnums[iii]] nirnoiz = nirnoiz1[0:nv2,vspecnums[iii]] ;unbin if binned wlvis = rebin(wlvis,256) wlnir = rebin(wlnir,238) visdata=rebin(visdata,256) visnoiz=rebin(visnoiz,256) nirdata=rebin(nirdata,238) nirnoiz=rebin(nirnoiz,238) ; Calculate Goodneess of Match at 300 nm ;================================ uv300=uvdata[45] vi300=visdata[0] goodness=vi300/uv300 ; Create components of the structure. ;==================================== UVVS_HEADER_FILE_ID = strupcase(file_basename(uvhdrfile)) ;1. UVVS Header File ID (from file list or lable) (string) UVVS_SCIENCE_FILE_ID = strupcase(file_basename(uvscifile)) ;2. UVVS Science File ID (from file list or lable) (string) VIRS_VIS_FILE_ID = strupcase(file_basename(vivisfile)) ;3. VIRS VIS File ID (from file list or lable) (string) VIRS_NIR_FILE_ID = strupcase(file_basename(vinirfile)) ;4. VIRS NIR File ID (from file list or lable) (string) VIRS_SPECTRUM_NUMBER = fix(vspecnums[iii]) ;5. VIRS Spectrum Number (derived/selected by automated/human matching) (int) UVVS_DRIFT = drift ;6. UVVS drift Distance in km from first to last step (derived from UVVS SCI DDR) (float) UVVS_SMEAR = smear ;7. UVVS smear as a % of footprint size (derived from UVVS SCI DDR) (float) UVVS_TARGET_LATITUDE_C0 = culats ;8. Lat, Lon cords of UVVS spectral footprints (center and 4 corners - C0, C1, C2, C3, C4 Copied from UVVS SCI DDR) (5 fields, each 46 float) UVVS_TARGET_LATITUDE_C1 = c1lats UVVS_TARGET_LATITUDE_C2 = c2lats UVVS_TARGET_LATITUDE_C3 = c3lats UVVS_TARGET_LATITUDE_C4 = c4lats UVVS_TARGET_LONGITUDE_C0 = culons UVVS_TARGET_LONGITUDE_C1 = c1lons UVVS_TARGET_LONGITUDE_C2 = c2lons UVVS_TARGET_LONGITUDE_C3 = c3lons UVVS_TARGET_LONGITUDE_C4 = c4lons VIRS_TARGET_LATITUDE_SET = vspeclat ;9. Lat, Lon cords of VIRS spectral footprint (center, and pointds describing the VIRS ovoid - C0, C1, C2, C3, C4 Copied from VIRS DDR) (5xfloat) VIRS_TARGET_LONGITUDE_SET = vspeclon VIRS_UVVS_CENTER_DISTANCE = uvvisdist ;10. Distance in km from center cords of UVVS to center cords of VIRS (Derived from UVVS SCI DDR and VIRS DDR) (float) VIRS_UVVS_OFFSET_PERCENTAGE = offset ;11. Distance % of footprint size from center cords of UVVS to center cords of VIRS (Derived from UVVS SCI DDR and VIRS DDR) (float) UVVS_CENTER_PHOT_ANGLES = uphot ;12. Average I, e, phase UVVS (copied from UVVS SCI DDR of central wavelength) (3xfloat) VIRS_CENTER_PHOT_ANGLES = vphot ;13. Average I, e, phase VIRS (copied from VIRS DDR) (3xfloat) VIRS_UVVS_MATCH = goodness ;14. "Goodness of Match" (derived from UVVS and VIRS DDR (photometrically corrected) reflectance at 300 nm -> (VIRS reflectance at 300 nm / UVVS reflectance at 300 nm)- 1.00 being perfect match) (float) DQI = [HotUVVS, HotVIRS, DQI3, DQI4,VIRSbinning,variability,'0'] ;15. DQI (int or 4xbinary, or as appropriate) ; a. Hot UVVS (threshold) (derived from UVVS SCI DDR) ; b. Hot VIRS (threshold) (derived from VIRS DDR) ; c. "AltVIRS (0/1) (derived/selected by automated/human matching) ; d. Secondary AltVIRS (not closest, but best) (0/1) (selected by human matching) ; e. VIRS Binning (0 for no. 1 for yes, binned by 2) ; f. landscape variability. Qualitative analysis of variability within UVVS footprint 1=low, 2=medium, 3=high ; g. spare FULLSPEC_WAVELENGTHS = [wluv,wlvis,wlnir] ;16. Wavelength file of combined spectrum: 46 UVVS wavelengths, 494 VIRS wavelengths (approx. 540xFloat) FULLSPEC_PHOTOM_IOF_DATA = [uvdata,visdata,nirdata] ;17. Photometrically corrected reflectance values of combined spectrum: 46 UVVS wavelengths, 494 VIRS wavelengths (approx. 540xFloat) FULLSPEC_PHOTOM_IOF_NOISE_DATA = [uvnoiz,visnoiz,nirnoiz] ;18. Photometrically corrected reflectance noise of combined spectrum: 46 UVVS wavelengths, 494 VIRS wavelengths (approx. 540xFloat) SPARE_1 = fltarr(1) ;19 Spares SPARE_2 = fltarr(1) SPARE_3 = fltarr(1) SPARE_4 = fltarr(1) COMBINED_DDR = { $ UVVS_HEADER_FILE_ID : strupcase(file_basename(uvhdrfile)) ,$ UVVS_SCIENCE_FILE_ID : strupcase(file_basename(uvscifile)) ,$ VIRS_VIS_FILE_ID : strupcase(file_basename(vivisfile)) ,$ VIRS_NIR_FILE_ID : strupcase(file_basename(vinirfile)) ,$ VIRS_SPECTRUM_NUMBER : fix(vspecnums[iii]) ,$ UVVS_DRIFT : drift ,$ UVVS_SMEAR : smear ,$ UVVS_TARGET_LATITUDE_C0 : culats ,$ UVVS_TARGET_LATITUDE_C1 : c1lats ,$ UVVS_TARGET_LATITUDE_C2 : c2lats ,$ UVVS_TARGET_LATITUDE_C3 : c3lats ,$ UVVS_TARGET_LATITUDE_C4 : c4lats ,$ UVVS_TARGET_LONGITUDE_C0 : culons ,$ UVVS_TARGET_LONGITUDE_C1 : c1lons ,$ UVVS_TARGET_LONGITUDE_C2 : c2lons ,$ UVVS_TARGET_LONGITUDE_C3 : c3lons ,$ UVVS_TARGET_LONGITUDE_C4 : c4lons ,$ VIRS_TARGET_LATITUDE_SET : vspeclat ,$ VIRS_TARGET_LONGITUDE_SET :vspeclon ,$ VIRS_UVVS_CENTER_DISTANCE : uvvisdist ,$ VIRS_UVVS_OFFSET_PERCENTAGE : offset ,$ UVVS_CENTER_PHOT_ANGLES : uphot ,$ VIRS_CENTER_PHOT_ANGLES : vphot ,$ VIRS_UVVS_MATCH : goodness ,$ DQI : [HotUVVS, HotVIRS, DQI3, DQI4,VIRSbinning,variability,'0'] ,$ FULLSPEC_WAVELENGTHS : [wluv,wlvis,wlnir] ,$ FULLSPEC_PHOTOM_IOF_DATA : [uvdata,visdata,nirdata] ,$ FULLSPEC_PHOTOM_IOF_NOISE_DATA : [uvnoiz,visnoiz,nirnoiz] ,$ SPARE_1 : fltarr(1) ,$ SPARE_2 : fltarr(1) ,$ SPARE_3 : fltarr(1) ,$ SPARE_4 : fltarr(1) } output[iii]=combined_DDR ; SAVE STRUCTURE AS BINARY ;TBD ; Plot, save plot, and save spectrum as CSV (For test and other purposes) ;========= ;plot=errorplot(FULLSPEC_WAVELENGTHS,FULLSPEC_PHOTOM_IOF_DATA,FULLSPEC_PHOTOM_IOF_NOISE_DATA, $ ; TITLE=file_basename(uvhdrfile)+' and '+file_basename(vivisfile), YTITLE="Reflectance", $ ; XTITLE="Wavelength (nm)",xrange=[200,1500],yrange=[0,.2]) ;plot.thick=2 ;plot.ERRORBAR_COLOR="indian_red" ;plot.ERRORBAR_CAPSIZE=0 ;plot.save,outdir+'UVVS-'+ufile+' VIRS-'+vfile+'.png',resolution=300,/transparent ;plot.close ;out=fltarr(3,540) ; out[0,*]=FULLSPEC_WAVELENGTHS ; out[1,*]=FULLSPEC_PHOTOM_IOF_DATA ; out[2,*]=FULLSPEC_PHOTOM_IOF_NOISE_DATA ;write_csv,outdir+ufile+'.csv',out print,' ' +UVVS_SCIENCE_FILE_ID endfor return end ;======================================== ;Input DDR Structure information ; ;** Structure UVVS_SURF_HEADER, 16 tags, length=36, data length=36: ;SC_TIME ULONG 45993668 ;PACKET_SUBSECONDS ;UINT 0 ;START_POS UINT 114 ;STEP_COUNT UINT 660 ;INT_TIME UINT 38 ;STEP_TIME UINT 6 ;PHASE_OFFSET UINT 2 ;SCAN_CYCLES UINT 0 ;ZIGZAG UINT 0 ;COMPRESSION UINT 0 ;SLIT_MASK_POS UINT 0 ;GD_SETTLE_CTR UINT 2393 ;NUM_SCAN_VALUES UINT 660 ;STEP_SIZE UINT 1 ;COADD UINT 1 ;CALIBRATION_SOFTWARE_VERSION FLOAT 1.00000 ; ;** Structure UVVS_SURF_DDR, 25 tags, length=280, data length=270: ;BIN_NUMBER UINT 0 ;TARGET_LATITUDE_SET DOUBLE Array[5] ;TARGET_LONGITUDE_SET DOUBLE Array[5] ;SLIT_ROTATION_ANGLE DOUBLE 2.0599470 ;ALONG_TRACK_FOOTPRINT_SIZE DOUBLE 0.0016780000 ;ACROSS_TRACK_FOOTPRINT_SIZE DOUBLE NaN ;INCIDENCE_ANGLE DOUBLE 42.214938 ;EMISSION_ANGLE DOUBLE 41.560320 ;PHASE_ANGLE DOUBLE 82.725432 ;SOLAR_DISTANCE DOUBLE 68045692. ;MIDBIN_TIME DOUBLE 45993670. ;BIN_UTC_TIME BYTE Array[17] ;BIN_WAVELENGTH FLOAT 210.000 ;IOF_BIN_DATA FLOAT 0.00529110 ;PHOTOM_IOF_BIN_DATA FLOAT 0.00483922 ;IOF_BIN_NOISE_DATA FLOAT 0.000662002 ;PHOTOM_IOF_BIN_NOISE_DATA FLOAT 0.000605465 ;FULLY_CORRECTED_COUNT_RATE FLOAT 1101.87 ;STEP_RADIANCE_W FLOAT 0.202208 ;PMT_TEMPERATURE FLOAT 11.7163 ;DATA_QUALITY_INDEX BYTE Array[21] ;OBSERVATION_TYPE BYTE Array[30] ;SPARE DOUBLE 0.0000000 ;SPARE_2 DOUBLE 0.0000000 ;SPARE_3 DOUBLE 0.0000000 ; ;** Structure VIRS_VIS_DDR, 33 tags, length=10464, data length=10458: ;SC_TIME LONG 45993640 ;PACKET_SUBSECONDS UINT 46 ;INT_TIME UINT 20 ;INT_COUNT UINT 46 ;DARK_FREQ UINT 5 ;TEMP_2 FLOAT 15.7170 ;BINNING UINT 1 ;START_PIXEL UINT 0 ;END_PIXEL UINT 361 ;SPECTRUM_NUMBER UINT 0 ;SPECTRUM_MET ULONG 45993640 ;SPECTRUM_SUBSECONDS UINT 229 ;SPECTRUM_UTC_TIME BYTE Array[17] ;IOF_SPECTRUM_DATA FLOAT Array[512] ;PHOTOM_IOF_SPECTRUM_DATA FLOAT Array[512] ;IOF_NOISE_SPECTRUM_DATA FLOAT Array[512] ;PHOTOM_IOF_NOISE_SPECTRUM_DATA FLOAT Array[512] ;SOFTWARE_VERSION FLOAT 1.00000 ;CHANNEL_WAVELENGTHS FLOAT Array[512] ;DATA_QUALITY_INDEX BYTE Array[19] ;TARGET_LATITUDE_SET DOUBLE Array[5] ;TARGET_LONGITUDE_SET DOUBLE Array[5] ;ALONG_TRACK_FOOTPRINT_SIZE DOUBLE 1449.4464 ;ACROSS_TRACK_FOOTPRINT_SIZE DOUBLE 1307.9314 ;INCIDENCE_ANGLE DOUBLE 42.218388 ;EMISSION_ANGLE DOUBLE 41.584815 ;PHASE_ANGLE DOUBLE 82.941087 ;SOLAR_DISTANCE DOUBLE 68045823. ;SPARE_1 FLOAT 0.00000 ;SPARE_2 LONG 0 ;SPARE_3 LONG 0 ;SPARE_4 LONG 0 ;SPARE_5 LONG 0