MESSENGER MASCS UVVS CDR TO ATMOSPHERE DDR PROCEDURES Version 4, 2/22/2016 Document Review William McClintock, MESSENGER Cognizant Co-Investigator/MASCS, has reviewed and approved this document. Noam Izenberg, MESSENGER MASCS Instrument Scientist, has reviewed and approved this document. Document Change History Version 1, 6/15/12 Version submitted for PDS peer review. Version 2, 1/31/13 Procedures revised for first Atmosphere DDR delivery (PDS Delivery 9). Version 3, 12/3/2013, C. Mauceri, ACT Revised and added calibration procedures. * open_mac41_na_ddr (revised) * open_mac65_na_ddr (revised) * open_mac66_na_ddr (revised) * open_mac67_na_ddr (revised) * open_mac68_na_ddr (revised) * concat_na_ddr (revised) * init_mascs_cdr_templates_6 (revised, formerly init_mascs_cdr_templates_5) * read_mascs_cdr_6 (revised, formerly read_mascs_cdr_5) * process_dayside_limb (revised) * process_limb_drifts (revised) * process_night_sweeps (revised) * open_mac85_na_ddr (added) * open_mac87_na_ddr (added) * open_mac91_na_ddr (added) * open_mac92_na_ddr (added) Version 4, 2/22/2016, C. Mauceri, ACT Revised and added calibration procedures. * concat_na_ddr_final (added) * process_dayside_limb_final (added) * process_limb_drifts_final (added) * process_night_sweeps_final (added) MASCS UVVS CDR to Atmosphere DDR pseudocode. This document describes high level "pseudocode" and tables which define the procedures used to convert MASCS UVVS Calibrated Data Records (CDRs) to Atmosphere 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 psuedocode below pertains to sodium however the procedures for magnesium and calcium are very similar. The PROCEDURES that are included; ;----------------------------------------------------------------------------- ; * open_mac41_na_ddr - searches for cdr files that pertain to macro 41. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac65_na_ddr - searches for cdr files that pertain to macro 65. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac66_na_ddr - searches for cdr files that pertain to macro 66. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac67_na_ddr - searches for cdr files that pertain to macro 67. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac68_na_ddr - searches for cdr files that pertain to macro 68. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac85_na_ddr - searches for cdr files that pertain to macro 85. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac87_na_ddr - searches for cdr files that pertain to macro 87. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac91_na_ddr - searches for cdr files that pertain to macro 91. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * open_mac92_na_ddr - searches for cdr files that pertain to macro 92. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * init_mascs_cdr_templates_6 - initializes data structure definitions ; for MASCS telemetry packets. This is one way to handle the data ; structures for MASCS. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * read_mascs_cdr_6 - reads data from a MASCS binary calibrated data ; record, returning an array of data structures that match the table ; structure defined in the CDR SIS documents for UVVS and VIRS. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * concat_na_ddr_final - compiles all the sodium data for the whole ; mission phase. There are 9 macro types (41,65,66,67,68,85,87,91,92) ; that can be used in operations to measure sodium. This program calls a ; program that searches the cdr database by date for each macro. The ; program reorganizes the sodium geometry and spectral information from ; the cdrs into a summary file as described in the UVVS_CDR_DDR_SIS ; document. The total intensity and signal-to-noise over the sodium ; band is calculated and included in the DDRs. The data are written out ; to an IDL save file as an interim data product. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * process_dayside_limb_final - concatenates the calibrated data to create ; the UVVS dayside limb DDR for a given species in a given Mercury Year. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * process_limb_drifts_final - concatenates the calibrated data to create ; the UVVS limb drift DDR for a given species in a given Mercury Year. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * process_night_sweeps_final - concatenates the calibrated data to create ; the UVVS night sweep DDR for a given species in a given Mercury Year. ;----------------------------------------------------------------------------- ;***************************************************************************** ; U V V S P R O C E D U R E S ;***************************************************************************** ;----------------------------------------------------------------------------- ; * open_mac41_na_ddr - searches for cdr files that pertain to macro 41. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac41_Na_DDR,xx,location,na_rad_kr,na_rad_unc,wvl,na_tot_rad_kr,na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num, obs_seq_index,orig,orbnum ii=0 ;Open up files for i=0,n_elements(xx)-1 do begin ; restore,xx(i) ;update parsing to generate SCI and HDR path+filenames. Uses strsplit so that the xx(i) string can be of any length ;this is the complete path to the _SCI.DAT file. ;RCE 11/09/2012 file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) print,'reading ',sci_fname print,'reading ',hdr_fname tube='VIS' wavelength_scale,test,ind,tube ind5=21. file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca nel=fix(n_elements(data.step_wavelength)/ind5) if nel eq 0 then nel=1 index5=float(nel)*ind5 w5=reform(data(0:index5-1).step_wavelength,ind5,nel) ckr5=reform(data(0:index5-1).step_radiance_kr,ind5,nel) k_unc=reform(data(0:index5-1).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(0:index5-1).dead_corrected_count_rate,ind5,nel) cc=reform(data(0:index5-1).fully_corrected_count_rate,ind5,nel) cu=reform(data(0:index5-1).fully_corrected_count_rate_uncertainty,ind5,nel) for l=0,fix(nel)/2-1 do ckr5(*,2*l+1)=reverse(ckr5(*,2*l+1)) for l=0,fix(nel)/2-1 do k_unc(*,2*l+1)=reverse(k_unc(*,2*l+1)) for l=0,fix(nel)/2-1 do cr(*,2*l+1)=reverse(cr(*,2*l+1)) for l=0,fix(nel)/2-1 do cc(*,2*l+1)=reverse(cc(*,2*l+1)) for l=0,fix(nel)/2-1 do cu(*,2*l+1)=reverse(cu(*,2*l+1)) for l=0,fix(nel)/2-1 do w5(*,2*l+1)=reverse(w5(*,2*l+1)) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] ;iind=[0,1] slit1=fltarr(nel)+header(0).slit_mask_pos na_tot_rad_kr1=fltarr(nel) na_tot_rad_unc1=fltarr(nel) na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 na_tot_rad_kr1 = total(ckr5[6:15,*],1) * na_wrange for l=0,fix(nel)/2-1 do na_tot_rad_kr1(2*l+1) = total(ckr5[4:13,2*l+1],1) * na_wrange na_tot_rad_unc1=total(cc[6:15,*],1)/sqrt(total(cu[6:15,*]^2,1)) for l=0,fix(nel)/2-1 do na_tot_rad_unc1(2*l+1) =total(cc[4:13,2*l+1],1)/sqrt(total(cu[4:13,2*l+1]^2,1)) scan_num1=findgen(n_elements(ckr5(0,*))) midtime1=reform(data(0:index5-1).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(0:index5-1).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(0:index5-1).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(0:index5-1).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(0:index5-1).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(0:index5-1).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(0:index5-1).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(0:index5-1).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(0:index5-1).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(0:index5-1).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(0:index5-1).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(0:index5-1).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(0:index5-1).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(0:index5-1).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(0:index5-1).step_utc_time,17,ind5,nel) obs_typ1=reform(data(0:index5-1).observation_type,30,ind5,nel) orbnum1=reform(data(0:index5-1).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin ;first element in array midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 na_rad_kr=ckr5 na_rad_unc=k_unc wvl=w5 na_tot_rad_kr=na_tot_rad_kr1 na_tot_rad_unc=na_tot_rad_unc1 slit=slit1 orig=cr endif else begin ;N element in array midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] na_rad_kr=[[na_rad_kr],[ckr5]] na_rad_unc=[[na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] na_tot_rad_kr=[na_tot_rad_kr,na_tot_rad_kr1] na_tot_rad_unc=[na_tot_rad_unc,na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse if min(obs_seq_index) eq 0 then stop return end ;----------------------------------------------------------------------------- ; * open_mac65_na_ddr - searches for cdr files that pertain to macro 65. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac65_Na_DDR,xx,location,Na_rad_kr,Na_rad_unc,wvl,Na_tot_rad_kr,Na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ;apply calibration to Macro 65 for Sodium species ii=0 for i=0,n_elements(xx)-1 do begin ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] slit1=fltarr(nel)+header(0).slit_mask_pos Na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 Na_tot_rad_kr1 = total(ckr5[6:15,*],1) * Na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) scan_num1=findgen(n_elements(ckr5(0,*))) ;extract geometry information from CDR midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 Na_rad_kr=ckr5 Na_rad_unc=k_unc wvl=w5 Na_tot_rad_kr=Na_tot_rad_kr1 Na_tot_rad_unc=Na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] Na_rad_kr=[[Na_rad_kr],[ckr5]] Na_rad_unc=[[Na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] Na_tot_rad_kr=[Na_tot_rad_kr,Na_tot_rad_kr1] Na_tot_rad_unc=[Na_tot_rad_unc,Na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse return end ;----------------------------------------------------------------------------- ; * open_mac66_na_ddr - searches for cdr files that pertain to macro 66. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac66_NA_DDR,xx,location,na_rad_kr,na_rad_unc,wvl,na_tot_rad_kr,na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg,boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ii=0 for i=0,n_elements(xx)-1 do begin ;restore,xx(i) ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range3=[test(2266),test(2286)]/10 ;21 ind3=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data K index3=where((data.step_wavelength ge range3(0)-.1 and data.step_wavelength le range3(1)+.1)) nel=fix(n_elements(index3)/ind3) if nel eq 0 then nel=1 index3=index3(0:nel*ind3-1) w3=reform(data(index3).step_wavelength,ind3,nel) ckr3=reform(data(index3).step_radiance_kr,ind3,nel) k_unc=reform(data(index3).step_radiance_signal_to_noise,ind3,nel) cr=reform(data(index3).dead_corrected_count_rate,ind3,nel) cc=reform(data(index3).fully_corrected_count_rate,ind3,nel) cu=reform(data(index3).fully_corrected_count_rate_uncertainty,ind3,nel) iind=[0,1,2,3,4,ind3-5,ind3-4,ind3-3,ind3-2,ind3-1] slit1=fltarr(nel)+header(0).slit_mask_pos scan_num1=findgen(n_elements(ckr3(0,*))) na_wrange = (total(w3[7:14,0]) - total(w3[6:13,0])) / 8.0 na_tot_rad_kr1 = total(ckr3[6:15,*],1) * na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) midtime1=reform(data(index3).midstep_time,ind3,nel) planet_sun_vector_TG1=reform(data(index3).planet_sun_vector_TG,3,ind3,nel) planet_SC_vector_TG1=reform(data(index3).planet_SC_vector_TG,3,ind3,nel) boresight_unit_vector_center_TG1=reform(data(index3).boresight_unit_vector_center_TG,3,ind3,nel) boresight_unit_vector_c1_tg1=reform(data(index3).boresight_unit_vector_C1_tg,3,ind3,nel) boresight_unit_vector_c2_tg1=reform(data(index3).boresight_unit_vector_C2_tg,3,ind3,nel) target_latitude_set1=reform(data(index3).target_latitude_set,5,ind3,nel) target_longitude_set1=reform(data(index3).target_longitude_set,5,ind3,nel) target_altitude_set1=reform(data(index3).target_altitude_set,5,ind3,nel) subspacecraft_latitude1=reform(data(index3).subspacecraft_latitude,ind3,nel) subspacecraft_longitude1=reform(data(index3).subspacecraft_longitude,ind3,nel) subsolar_latitude1=reform(data(index3).subsolar_latitude,ind3,nel) subsolar_longitude1=reform(data(index3).subsolar_longitude,ind3,nel) true_anomaly1=reform(data(index3).planet_true_anomaly,ind3,nel) step_utc_time1=reform(data(index3).step_utc_time,17,ind3,nel) obs_typ1=reform(data(index3).observation_type,30,ind3,nel) orbnum1=reform(data(index3).orbit_number,ind3,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 na_rad_kr=ckr3 na_rad_unc=k_unc wvl=w3 na_tot_rad_kr=na_tot_rad_kr1 na_tot_rad_unc=na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] na_rad_kr=[[na_rad_kr],[ckr3]] na_rad_unc=[[na_rad_unc],[k_unc]] wvl=[[wvl],[w3]] na_tot_rad_kr=[na_tot_rad_kr,na_tot_rad_kr1] na_tot_rad_unc=[na_tot_rad_unc,na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse if min(obs_seq_index) eq 0 then stop return end ;----------------------------------------------------------------------------- ; * open_mac67_na_ddr - searches for cdr files that pertain to macro 67. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac67_Na_DDR,xx,location,na_rad_kr,na_rad_unc,wvl,na_tot_rad_kr,na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg,boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ii=0 ;Open up files for i=0,n_elements(xx)-1 do begin ;restore,xx(i) ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data Na index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] slit1=fltarr(nel)+header(0).slit_mask_pos scan_num1=findgen(n_elements(ckr5(0,*))) na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 na_tot_rad_kr1 = total(ckr5[6:15,*],1) * na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 na_rad_kr=ckr5 na_rad_unc=k_unc wvl=w5 na_tot_rad_kr=na_tot_rad_kr1 na_tot_rad_unc=na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] na_rad_kr=[[na_rad_kr],[ckr5]] na_rad_unc=[[na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] na_tot_rad_kr=[na_tot_rad_kr,na_tot_rad_kr1] na_tot_rad_unc=[na_tot_rad_unc,na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse if min(obs_seq_index) eq 0 then stop return end ;----------------------------------------------------------------------------- ; * open_mac68_na_ddr - searches for cdr files that pertain to macro 68. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac68_Na_DDR,xx,location,na_rad_kr,na_rad_unc,wvl,na_tot_rad_kr,na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg,boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ii=0 ;Open up files for i=0,n_elements(xx)-1 do begin ; restore,xx(i) ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] ;iind=[0,1] slit1=fltarr(nel)+header(0).slit_mask_pos scan_num1=findgen(n_elements(ckr5(0,*))) na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 na_tot_rad_kr1 = total(ckr5[6:15,*],1) * na_wrange ;na_tot_rad_unc1 = sqrt(total(k_unc[6:15,*]^2.0,1)) na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 na_rad_kr=ckr5 na_rad_unc=k_unc wvl=w5 na_tot_rad_kr=na_tot_rad_kr1 na_tot_rad_unc=na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] na_rad_kr=[[na_rad_kr],[ckr5]] na_rad_unc=[[na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] na_tot_rad_kr=[na_tot_rad_kr,na_tot_rad_kr1] na_tot_rad_unc=[na_tot_rad_unc,na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse if min(obs_seq_index) eq 0 then stop return end ;----------------------------------------------------------------------------- ; * open_mac85_na_ddr - searches for cdr files that pertain to macro 85. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac85_Na_DDR,xx,location,Na_rad_kr,Na_rad_unc,wvl,Na_tot_rad_kr,Na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ;apply calibration to Macro 65 for Sodium species ii=0 for i=0,n_elements(xx)-1 do begin ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] slit1=fltarr(nel)+header(0).slit_mask_pos Na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 Na_tot_rad_kr1 = total(ckr5[6:15,*],1) * Na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) scan_num1=findgen(n_elements(ckr5(0,*))) ;extract geometry information from CDR midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 Na_rad_kr=ckr5 Na_rad_unc=k_unc wvl=w5 Na_tot_rad_kr=Na_tot_rad_kr1 Na_tot_rad_unc=Na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] Na_rad_kr=[[Na_rad_kr],[ckr5]] Na_rad_unc=[[Na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] Na_tot_rad_kr=[Na_tot_rad_kr,Na_tot_rad_kr1] Na_tot_rad_unc=[Na_tot_rad_unc,Na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse return end ;----------------------------------------------------------------------------- ; * open_mac87_na_ddr - searches for cdr files that pertain to macro 87. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac87_Na_DDR,xx,location,Na_rad_kr,Na_rad_unc,wvl,Na_tot_rad_kr,Na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ;apply calibration to Macro 65 for Sodium species ii=0 for i=0,n_elements(xx)-1 do begin ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] slit1=fltarr(nel)+header(0).slit_mask_pos Na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 Na_tot_rad_kr1 = total(ckr5[6:15,*],1) * Na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) scan_num1=findgen(n_elements(ckr5(0,*))) ;extract geometry information from CDR midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 Na_rad_kr=ckr5 Na_rad_unc=k_unc wvl=w5 Na_tot_rad_kr=Na_tot_rad_kr1 Na_tot_rad_unc=Na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] Na_rad_kr=[[Na_rad_kr],[ckr5]] Na_rad_unc=[[Na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] Na_tot_rad_kr=[Na_tot_rad_kr,Na_tot_rad_kr1] Na_tot_rad_unc=[Na_tot_rad_unc,Na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse return end ;----------------------------------------------------------------------------- ; * open_mac91_na_ddr - searches for cdr files that pertain to macro 91. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac91_Na_DDR,xx,location,Na_rad_kr,Na_rad_unc,wvl,Na_tot_rad_kr,Na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ;apply calibration to Macro 65 for Sodium species ii=0 for i=0,n_elements(xx)-1 do begin ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] slit1=fltarr(nel)+header(0).slit_mask_pos Na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 Na_tot_rad_kr1 = total(ckr5[6:15,*],1) * Na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) scan_num1=findgen(n_elements(ckr5(0,*))) ;extract geometry information from CDR midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 Na_rad_kr=ckr5 Na_rad_unc=k_unc wvl=w5 Na_tot_rad_kr=Na_tot_rad_kr1 Na_tot_rad_unc=Na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] Na_rad_kr=[[Na_rad_kr],[ckr5]] Na_rad_unc=[[Na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] Na_tot_rad_kr=[Na_tot_rad_kr,Na_tot_rad_kr1] Na_tot_rad_unc=[Na_tot_rad_unc,Na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse return end ;----------------------------------------------------------------------------- ; * open_mac92_na_ddr - searches for cdr files that pertain to macro 92. ; Sorts out the sodium data and geometry information and sends it back ; to concat_na_ddr_final where it is concatenated. The total intensity ; and signal-to-noise are calculated over the spectral band. ;----------------------------------------------------------------------------- PRO open_mac92_Na_DDR,xx,location,Na_rad_kr,Na_rad_unc,wvl,Na_tot_rad_kr,Na_tot_rad_unc,midtime,planet_sun_vector_tg,planet_sc_vector_tg,boresight_unit_vector_center_tg,target_latitude_set,target_longitude_set,$ target_altitude_set,subspacecraft_latitude,subspacecraft_longitude,subsolar_latitude,subsolar_longitude,step_utc_time,jd_obs,yd_obs,ymd_obs,filename,macro,scan_num,$ boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg,true_anomaly,slit,obs_typ,obs_typ_num,obs_seq_index,orig,orbnum ;apply calibration to Macro 65 for Sodium species ii=0 for i=0,n_elements(xx)-1 do begin ;this is the complete path to the _SCI.DAT file. file_i = xx(i) print, 'file_i:',file_i ;want to retrieve path+base filename. This method does not rely on the path+filename being a certain length ;it splits the string on the last part of the filename fileparts = strsplit(file_i,'SCI.DAT', /EXTRACT, /REGEX) base_fname = fileparts(0) print, 'path+basefilename',base_fname ;now we can construct the full path to the SCIENCE and Header CDRs if location eq 0 then begin sci_fname = base_fname+'SCI.DAT.SAV' restore,xx(i) endif else begin sci_fname = base_fname+'SCI.DAT' data=read_mascs_cdr_6(sci_fname) endelse hdr_fname = base_fname+'HDR.DAT' header=read_mascs_cdr_6(hdr_fname) tube='VIS' wavelength_scale,test,ind,tube range5=[test(2266),test(2286)]/10 ;21 ind5=21 file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;index data ca index5=where((data.step_wavelength ge range5(0)-.1 and data.step_wavelength le range5(1)+.1)) nel=fix(n_elements(index5)/ind5) if nel eq 0 then nel=1 index5=index5(0:nel*ind5-1) w5=reform(data(index5).step_wavelength,ind5,nel) ckr5=reform(data(index5).step_radiance_kr,ind5,nel) k_unc=reform(data(index5).step_radiance_signal_to_noise,ind5,nel) cr=reform(data(index5).dead_corrected_count_rate,ind5,nel) cc=reform(data(index5).fully_corrected_count_rate,ind5,nel) cu=reform(data(index5).fully_corrected_count_rate_uncertainty,ind5,nel) iind=[0,1,2,3,4,ind5-5,ind5-4,ind5-3,ind5-2,ind5-1] slit1=fltarr(nel)+header(0).slit_mask_pos Na_wrange = (total(w5[7:14,0]) - total(w5[6:13,0])) / 8.0 Na_tot_rad_kr1 = total(ckr5[6:15,*],1) * Na_wrange na_tot_rad_unc1=total(cc(6:15,*),1)/sqrt(total(cu(6:15,*)^2,1)) scan_num1=findgen(n_elements(ckr5(0,*))) ;extract geometry information from CDR midtime1=reform(data(index5).midstep_time,ind5,nel) planet_sun_vector_TG1=reform(data(index5).planet_sun_vector_TG,3,ind5,nel) planet_SC_vector_TG1=reform(data(index5).planet_SC_vector_TG,3,ind5,nel) boresight_unit_vector_center_TG1=reform(data(index5).boresight_unit_vector_center_TG,3,ind5,nel) boresight_unit_vector_c1_tg1=reform(data(index5).boresight_unit_vector_C1_tg,3,ind5,nel) boresight_unit_vector_c2_tg1=reform(data(index5).boresight_unit_vector_C2_tg,3,ind5,nel) target_latitude_set1=reform(data(index5).target_latitude_set,5,ind5,nel) target_longitude_set1=reform(data(index5).target_longitude_set,5,ind5,nel) target_altitude_set1=reform(data(index5).target_altitude_set,5,ind5,nel) subspacecraft_latitude1=reform(data(index5).subspacecraft_latitude,ind5,nel) subspacecraft_longitude1=reform(data(index5).subspacecraft_longitude,ind5,nel) subsolar_latitude1=reform(data(index5).subsolar_latitude,ind5,nel) subsolar_longitude1=reform(data(index5).subsolar_longitude,ind5,nel) true_anomaly1=reform(data(index5).planet_true_anomaly,ind5,nel) step_utc_time1=reform(data(index5).step_utc_time,17,ind5,nel) obs_typ1=reform(data(index5).observation_type,30,ind5,nel) orbnum1=reform(data(index5).orbit_number,ind5,nel) step_utc_time1=string(step_utc_time1) obs_typ1=string(obs_typ1) midtime1=reform(midtime1(11,*)) planet_sun_vector_TG1=reform(planet_sun_vector_TG1(*,11,*)) planet_SC_vector_TG1=reform(planet_SC_vector_TG1(*,11,*)) boresight_unit_vector_center_TG1=reform(boresight_unit_vector_center_TG1(*,11,*)) boresight_unit_vector_C1_tg1=reform(boresight_unit_vector_C1_tg1(*,11,*)) boresight_unit_vector_C2_tg1=reform(boresight_unit_vector_C2_tg1(*,11,*)) target_latitude_set1=reform(target_latitude_set1(*,11,*)) target_longitude_set1=reform(target_longitude_set1(*,11,*)) target_altitude_set1=reform(target_altitude_set1(*,11,*)) subspacecraft_latitude1=reform(subspacecraft_latitude1(11,*)) subspacecraft_longitude1=reform(subspacecraft_longitude1(11,*)) subsolar_latitude1=reform(subsolar_latitude1(11,*)) subsolar_longitude1=reform(subsolar_longitude1(11,*)) true_anomaly1=reform(true_anomaly1(11,*)) step_utc_time1=reform(step_utc_time1(11,*)) obs_typ1=reform(obs_typ1(11,*)) orbnum1=reform(orbnum1(11,*)) macro1=fltarr(n_elements(midtime1))+macrotop filename1=strarr(n_elements(midtime1))+filenametop yeardoy = strmid( step_utc_time1, 0, 5 )+2000000. ymd=yd2ymd(yeardoy) month=ymd(1,*) day=ymd(2,*) year=ymd(0,*) doy = strmid( step_utc_time1, 2, 3 ) hr = strmid(step_utc_time1 , 6, 2 ) min = strmid(step_utc_time1 , 9, 2 ) sec = strmid(step_utc_time1 , 12, 4 ) jd_obs1 = julday( month, day, year, hr, min, sec ) jd_obs1=reform(jd_obs1) yd_obs1=jd2yd(jd_obs1) ymd_obs1=jd2ymd(jd_obs1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concat if ii eq 0 then begin midtime=midtime1 planet_sun_vector_TG=planet_sun_vector_TG1 planet_SC_vector_TG=planet_SC_vector_TG1 boresight_unit_vector_center_TG=boresight_unit_vector_center_TG1 boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg1 boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg1 target_latitude_set=target_latitude_set1 target_longitude_set=target_longitude_set1 target_altitude_set=target_altitude_set1 subspacecraft_latitude=subspacecraft_latitude1 subspacecraft_longitude=subspacecraft_longitude1 subsolar_latitude=subsolar_latitude1 subsolar_longitude=subsolar_longitude1 true_anomaly=true_anomaly1 step_utc_time=step_utc_time1 macro=macro1 filename=filename1 scan_num=scan_num1 obs_typ=obs_typ1 orbnum=orbnum1 jd_obs=jd_obs1 yd_obs=yd_obs1 ymd_obs=ymd_obs1 Na_rad_kr=ckr5 Na_rad_unc=k_unc wvl=w5 Na_tot_rad_kr=Na_tot_rad_kr1 Na_tot_rad_unc=Na_tot_rad_unc1 slit=slit1 orig=cr endif else begin midtime=[midtime,midtime1] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_TG1]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG1]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG1]] boresight_unit_vector_C1_tg=[[boresight_unit_vector_C1_tg],[boresight_unit_vector_C1_tg1]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg1]] target_latitude_set=[[target_latitude_set],[target_latitude_set1]] target_longitude_set=[[target_longitude_set],[target_longitude_set1]] target_altitude_set=[[target_altitude_set],[target_altitude_set1]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude1] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude1] subsolar_latitude=[subsolar_latitude,subsolar_latitude1] subsolar_longitude=[subsolar_longitude,subsolar_longitude1] true_anomaly=[true_anomaly,true_anomaly1] step_utc_time=[step_utc_time,step_utc_time1] macro=[macro,macro1] filename=[filename,filename1] scan_num=[scan_num,scan_num1] obs_typ=[obs_typ,obs_typ1] orbnum=[orbnum,orbnum1] jd_obs=[jd_obs,jd_obs1] yd_obs=[yd_obs,yd_obs1] ymd_obs=[[ymd_obs],[ymd_obs1]] Na_rad_kr=[[Na_rad_kr],[ckr5]] Na_rad_unc=[[Na_rad_unc],[k_unc]] wvl=[[wvl],[w5]] Na_tot_rad_kr=[Na_tot_rad_kr,Na_tot_rad_kr1] Na_tot_rad_unc=[Na_tot_rad_unc,Na_tot_rad_unc1] slit=[slit,slit1] orig=[[orig],[cr]] endelse ii=ii+1 endfor index=n_elements(obs_typ) Obs_typ_num=fltarr(index) uu=where(strmatch(obs_typ,'UVVSDaysideScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=1 uu=where(strmatch(obs_typ,'UVVSLimbOpp*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=2 uu=where(strmatch(obs_typ,'UVVSLimbStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=3 uu=where(strmatch(obs_typ,'UVVSExoStare*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=4 uu=where(strmatch(obs_typ,'UVVSExoScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=5 uu=where(strmatch(obs_typ,'UVVSExoNadir*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=6 uu=where(strmatch(obs_typ,'UVVS360Roll*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=7 uu=where(strmatch(obs_typ,'UVVSNightShadow*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=8 uu=where(strmatch(obs_typ,'UVVSNightColumn*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=9 uu=where(strmatch(obs_typ,'UVVSDownlinkRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=10 uu=where(strmatch(obs_typ,'UVVSEPSEquatorRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=11 uu=where(strmatch(obs_typ,'UVVSFIPSNightsideRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=12 uu=where(strmatch(obs_typ,'UVVSFIPSMPTangentRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=13 uu=where(strmatch(obs_typ,'UVVSPolarScan*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=14 sh=obs_typ_num-shift(obs_typ_num, 1) shif=where(sh ne 0) obs_seq_index=fltarr(index) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq_index(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq_index(shif(k):index-1)=reverse(findgen(index-shif(k))+1) if shif(0) ne 0 then obs_seq_index(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq_index=reverse(findgen(index)+1) endelse return end ;----------------------------------------------------------------------------- ; * init_mascs_cdr_templates_6 - initializes data structure definitions ; for MASCS telemetry packets. This is one way to handle the data ; structures for MASCS. ;----------------------------------------------------------------------------- pro init_mascs_cdr_templates_6 ; Run this to set up the data structures for MASCS CDR files. ; ; v1.0 10/10/09 mrl ; v1.1 4/19/10 mrl Updated: changed spare_1 (double) to SC_time (ulong) ; to match revised SOC template for CDRs ; ; V2 8/2011 AWM Renamed to init_mascs_cdr_templates_4 to be consistent with read_mascs_cdr4 ; Updated to replace SPARE_2 (double) with PMT_Temperature (float) ; Moved the location of PMT_Temperature in the Structure allocation. ; Changed name of Radiance Uncertainty to STEP_RADIANCE_SIGNAL_TO_NOISE ; v3.0 5/9/12 mrl Updated to remove 4 fields of pointing information that ; no one is using. (Saves 96 bytes per record.) ; v5 Re-named with a '5' on the end to make it easier to ; identify it as a MASCS CDR Reader v5 file. ; v6 SPARE_2 is now used: ORBIT_NUMBER, and renamed to '6'. uvvs_cdr_hdr = { $ cdr_hdr, $ SEQ_COUNTER:UINT(0), $ SC_TIME:ULONG(0), $ PACKET_SUBSECONDS:UINT(0), $ START_POS:UINT(0), $ STEP_COUNT:UINT(0), $ INT_TIME:UINT(0), $ STEP_TIME:UINT(0), $ PHASE_OFFSET:UINT(0), $ SCAN_CYCLES:UINT(0), $ ZIGZAG:UINT(0), $ COMPRESSION:UINT(0), $ SLIT_MASK_POS:UINT(0), $ FUV_ON:UINT(0), $ MUV_ON:UINT(0), $ VIS_ON:UINT(0), $ BUFFER_OVERFLOW:UINT(0), $ SPARE_BITS:UINT(0), $ GD_SETTLE_CTR:UINT(0), $ NUM_SCAN_VALUES:UINT(0), $ STEP_SIZE:UINT(0), $ PAD_BYTE:UINT(0), $ COADD:UINT(0), $ CALIBRATION_SOFTWARE_VERSION:FLOAT(0) $ } uvvs_cdr_sci = { $ cdr_sci, $ STEP_NUMBER:UINT(0), $ ;PLANET_SUN_VECTOR_J2:DBLARR(3), $ ; v3.0 set of J2000 fields deleted ;PLANET_SC_VECTOR_J2:DBLARR(3), $ ;SPACECRAFT_POSITION_VECTOR_J2:DBLARR(3), $ ;SUN_POSITION_VECTOR_J2:DBLARR(3), $ ;TARGET_BODY_VECTOR_J2:DBLARR(3), $ ;BORESIGHT_UNIT_VECTOR_CENTER_J2:DBLARR(3), $ ;BORESIGHT_UNIT_VECTOR_C1_J2:DBLARR(3), $ ;BORESIGHT_UNIT_VECTOR_C2_J2:DBLARR(3), $ ;BORESIGHT_UNIT_VECTOR_C3_J2:DBLARR(3), $ ;BORESIGHT_UNIT_VECTOR_C4_J2:DBLARR(3), $ PLANET_SUN_VECTOR_TG:DBLARR(3), $ PLANET_SC_VECTOR_TG:DBLARR(3), $ BORESIGHT_UNIT_VECTOR_CENTER_TG:DBLARR(3), $ BORESIGHT_UNIT_VECTOR_C1_TG:DBLARR(3), $ BORESIGHT_UNIT_VECTOR_C2_TG:DBLARR(3), $ BORESIGHT_UNIT_VECTOR_C3_TG:DBLARR(3), $ BORESIGHT_UNIT_VECTOR_C4_TG:DBLARR(3), $ SURFACE_TANGENT_VECTOR_CENTER:DBLARR(3), $ SURFACE_TANGENT_VECTOR_C1:DBLARR(3), $ SURFACE_TANGENT_VECTOR_C2:DBLARR(3), $ SURFACE_TANGENT_VECTOR_C3:DBLARR(3), $ SURFACE_TANGENT_VECTOR_C4:DBLARR(3), $ RA_SET:DBLARR(5), $ DEC_SET:DBLARR(5), $ TARGET_LATITUDE_SET:DBLARR(5), $ TARGET_LONGITUDE_SET:DBLARR(5), $ TARGET_ALTITUDE_SET:DBLARR(5), $ SLIT_ROTATION_ANGLE:double(0), $ ALONG_TRACK_FOOTPRINT_SIZE:double(0), $ ACROSS_TRACK_FOOTPRINT_SIZE:double(0), $ FOOTPRINT_AZIMUTH:double(0), $ INCIDENCE_ANGLE:double(0), $ EMISSION_ANGLE:double(0), $ PHASE_ANGLE:double(0), $ SLANT_RANGE_TO_CENTER:double(0), $ SUBSPACECRAFT_LATITUDE:double(0), $ SUBSPACECRAFT_LONGITUDE:double(0), $ NADIR_ALTITUDE:double(0), $ SUBSOLAR_LATITUDE:double(0), $ SUBSOLAR_LONGITUDE:double(0), $ SOLAR_DISTANCE:double(0), $ PLANET_TRUE_ANOMALY:double(0), $ MIDSTEP_TIME:double(0), $ STEP_UTC_TIME:bytarr(17), $ GRATING_OFFSET:float(0), $ STEP_POSITION:long(0), $ STEP_WAVELENGTH:float(0), $ RAW_STEP_DATA:uint(0), $ COUNT_RATE:float(0), $ DEAD_CORRECTED_COUNT_RATE:float(0), $ DARK_RATE:float(0), $ SCATTERED_LIGHT_RATE:float(0), $ FULLY_CORRECTED_COUNT_RATE:float(0), $ FULLY_CORRECTED_COUNT_RATE_UNCERTAINTY:float(0), $ STEP_RADIANCE_KR:float(0), $ STEP_RADIANCE_W:float(0), $ STEP_RADIANCE_SIGNAL_TO_NOISE:float(0), $ PMT_TEMPERATURE:float(0), $ DATA_QUALITY_INDEX:bytarr(21), $ SC_TIME:ulong(0), $ ; v1.1 spare_1 changed to SC_TIME, was double, now ulong OBSERVATION_TYPE:bytarr(30), $ ; v3.0 ORBIT_NUMBER:double(0) $ ; v5.1 Using up the last spare field. } virs_vis_cdr = { $ vis_cdr, $ SEQ_COUNTER:UINT(0), $ SC_TIME:ulong(0), $ PACKET_SUBSECONDS:UINT(0), $ INT_TIME:UINT(0), $ INT_COUNT:UINT(0), $ PERIOD:UINT(0), $ DARK_FREQ:UINT(0), $ TEMP_1:float(0), $ TEMP_2:float(0), $ NIR_GAIN:UINT(0), $ OTHER_CHANNEL_ON:UINT(0), $ NIR_LAMP_ON:UINT(0), $ VIS_LAMP_ON:UINT(0), $ BINNING:UINT(0), $ START_PIXEL:UINT(0), $ END_PIXEL:UINT(0), $ SPECTRUM_NUMBER:UINT(0), $ SPECTRUM_MET:ulong(0), $ SPECTRUM_SUBSECONDS:UINT(0), $ RAW_SPECTRUM_DATA:intarr(512), $ SPECTRUM_UTC_TIME:bytarr(17), $ CORRECTED_COUNTS_SPECTRUM_DATA:fltarr(512), $ CALIBRATED_RADIANCE_SPECTRUM_DATA:fltarr(512), $ NOISE_SPECTRUM_DATA:fltarr(512), $ CALIBRATION_SOFTWARE_VERSION:float(0), $ CHANNEL_WAVELENGTHS:fltarr(512), $ HK_DATA_FLAG:long(0), $ DATA_QUALITY_INDEX:bytarr(19), $ VIRS_GRATING_TEMP:float(0), $ ;SPACECRAFT_POSITION_VECTOR:dblarr(3), $ These 4 fields deleted for v3.0 ;SUN_POSITION_VECTOR:dblarr(3), $ ;TARGET_BODY_VECTOR:dblarr(3), $ ;INSTRUMENT_BORESIGHT_VECTOR:dblarr(3), $ TARGET_LATITUDE_SET:dblarr(5), $ TARGET_LONGITUDE_SET:dblarr(5), $ ALONG_TRACK_FOOTPRINT_SIZE:double(0), $ ACROSS_TRACK_FOOTPRINT_SIZE:double(0), $ FOOTPRINT_AZIMUTH:double(0), $ INCIDENCE_ANGLE:double(0), $ EMISSION_ANGLE:double(0), $ PHASE_ANGLE:double(0), $ SLANT_RANGE_TO_CENTER:double(0), $ SUBSPACECRAFT_LATITUDE:double(0), $ SUBSPACECRAFT_LONGITUDE:double(0), $ NADIR_ALTITUDE:double(0), $ SUBSOLAR_LATITUDE:double(0), $ SUBSOLAR_LONGITUDE:double(0), $ SOLAR_DISTANCE:double(0), $ PLANET_TRUE_ANOMALY:double(0), $ SPARE_1:float(0), $ RIGHT_ASCENSION:double(0), $ DECLINATION:double(0), $ SPARE_2:long(0), $ SPARE_3:long(0), $ SPARE_4:long(0), $ SPARE_5:long(0), $ SPARE_6:long(0), $ SPARE_7:long(0), $ SPARE_8:long(0), $ SPARE_9:long(0), $ SPARE_10:long(0), $ SPARE_11:long(0) $ } virs_nir_cdr = { $ nir_cdr, $ SEQ_COUNTER:UINT(0), $ SC_TIME:ulong(0), $ PACKET_SUBSECONDS:UINT(0), $ INT_TIME:UINT(0), $ INT_COUNT:UINT(0), $ PERIOD:UINT(0), $ DARK_FREQ:UINT(0), $ TEMP_1:float(0), $ TEMP_2:float(0), $ NIR_GAIN:UINT(0), $ OTHER_CHANNEL_ON:UINT(0), $ NIR_LAMP_ON:UINT(0), $ VIS_LAMP_ON:UINT(0), $ BINNING:UINT(0), $ START_PIXEL:UINT(0), $ END_PIXEL:UINT(0), $ SPECTRUM_NUMBER:UINT(0), $ SPECTRUM_MET:ulong(0), $ SPECTRUM_SUBSECONDS:UINT(0), $ RAW_SPECTRUM_DATA:intarr(256), $ SPECTRUM_UTC_TIME:bytarr(17), $ CORRECTED_COUNTS_SPECTRUM_DATA:fltarr(256), $ CALIBRATED_RADIANCE_SPECTRUM_DATA:fltarr(256), $ NOISE_SPECTRUM_DATA:fltarr(256), $ CALIBRATION_SOFTWARE_VERSION:float(0), $ CHANNEL_WAVELENGTHS:fltarr(256), $ HK_DATA_FLAG:long(0), $ DATA_QUALITY_INDEX:bytarr(19), $ VIRS_GRATING_TEMP:float(0), $ ;SPACECRAFT_POSITION_VECTOR:dblarr(3), $ These 4 fields deleted for v3.0 ;SUN_POSITION_VECTOR:dblarr(3), $ ;TARGET_BODY_VECTOR:dblarr(3), $ ;INSTRUMENT_BORESIGHT_VECTOR:dblarr(3), $ TARGET_LATITUDE_SET:dblarr(5), $ TARGET_LONGITUDE_SET:dblarr(5), $ ALONG_TRACK_FOOTPRINT_SIZE:double(0), $ ACROSS_TRACK_FOOTPRINT_SIZE:double(0), $ FOOTPRINT_AZIMUTH:double(0), $ INCIDENCE_ANGLE:double(0), $ EMISSION_ANGLE:double(0), $ PHASE_ANGLE:double(0), $ SLANT_RANGE_TO_CENTER:double(0), $ SUBSPACECRAFT_LATITUDE:double(0), $ SUBSPACECRAFT_LONGITUDE:double(0), $ NADIR_ALTITUDE:double(0), $ SUBSOLAR_LATITUDE:double(0), $ SUBSOLAR_LONGITUDE:double(0), $ SOLAR_DISTANCE:double(0), $ PLANET_TRUE_ANOMALY:double(0), $ SPARE_1:float(0), $ RIGHT_ASCENSION:double(0), $ DECLINATION:double(0), $ SPARE_2:long(0), $ SPARE_3:long(0), $ SPARE_4:long(0), $ SPARE_5:long(0), $ SPARE_6:long(0), $ SPARE_7:long(0), $ SPARE_8:long(0), $ SPARE_9:long(0), $ SPARE_10:long(0), $ SPARE_11:long(0) $ } end ;----------------------------------------------------------------------------- ; * read_mascs_cdr_6 - reads data from a MASCS binary calibrated data ; record, returning an array of data structures that match the table ; structure defined in the CDR SIS documents for UVVS and VIRS. ;----------------------------------------------------------------------------- function read_mascs_cdr_6, filename ; v1.0 mrl 10/10/09 Read data from a MASCS binary Calibrated Data Record, ; returning an array of data structures that match the ; table structure defined in the CDR SIS documents for ; UVVS and VIRS ; Works on all 4 flavors of CDR: UVVS header, UVVS data, ; VIRS VIS, and VIRS NIR. ; Reworked from the original to avoid the used of binary ; templates, which seem to be causing problems with ; MacOS implementation on 10.6.x and IDL7.1 (at least). ; ; v1.1 mrl 5/25/10 Changed loop counters to longs to handle large files. ; ; v1.2 mrl 8/19/10 Renamed to read_mascs_cdr3.pro. Major change to improve ; speed: space for the entire array of structures is now ; allocated at the start. Much, much faster. ; V2 8/2011 AWM Renamed to read_mascs_cdr4.pro ; Updated to replace SPARE_2 (double) with PMT_Temperature (float) ; Moved the location of PMT_Temperature in the Structure allocation ; Changed name of Radiance Uncertainty to STEP_RADIANCE_SIGNAL_TO_NOISE ; ; v3.0 mrl 5/11/12 Changed name again to "read_mascs_cdr_5.pro to signal ; revisions to the CDR format. Subprograms have also been ; updated; use the ones with a '5' in the name. ; v6 mrl 7/14/13 Last UVVS spare field is now used, for ORBIT_NUMBER ; ; Developer contact information: ; Mark Lankton ; University of Colorado/LASP ; mark.lankton@lasp.colorado.edu ; 303-492-7915 office ; 720-272-6555 cell if n_params() ne 1 then filename = dialog_pickfile() if filename eq '' then return, -1 init_mascs_cdr_templates_6 ; Key text from CDR file names, to identify the type of data in file visname = 'VIRSVC*.DAT' nirname = 'VIRSNC*.DAT' uvvshdrname = '*HDR.DAT' uvvssciname = '*SCI.DAT' ; Constants derived from UVVS and VIRS CDR formats nirsize = 4954 ; was 5050 in previous version vissize = 9562 ; was 9658 in previous version uvvshdrsize = 50 uvvsscisize = 752 ; Was 970 in previous version ; These will come in handy below. isUVVSSci = 1 isUVVSHdr = 2 isVISSci = 3 isNIRSci = 4 whichType = 0 justname = strupcase(file_basename(filename)) info = file_info(filename) openr, theLUN, filename, /get_LUN if strmatch(justname, visname) then begin num_data = info.size / vissize whichType = isVISSCI dummy = {vis_cdr} endif else if strmatch(justname, nirname) then begin num_data = info.size / nirsize whichType = isNIRSci dummy = {nir_cdr} endif else if strmatch(justname, uvvshdrname) then begin num_data = info.size / uvvshdrsize whichType = isUVVSHdr dummy = {cdr_hdr} endif else if strmatch(justname, uvvssciname) then begin num_data = info.size / uvvsscisize whichType = isUVVSSci dummy = {cdr_sci} endif else begin print, 'Unknown file type' return, -1 endelse print, 'number of items:', num_data result = replicate(dummy, num_data) case whichType of isUVVSHdr: begin for i = long(0), num_data -1 do begin result[i] = read_uvvs_cdr_hdr_6(theLUN) endfor end isUVVSSci: begin for i = long(0), num_data -1 do begin result[i] = read_uvvs_cdr_sci_6(theLUN) endfor end isVISSCI: begin for i = long(0), num_data -1 do begin result[i] = read_virs_vis_cdr_6(theLUN) endfor end isNIRSci: begin for i = long(0), num_data -1 do begin result[i] = read_virs_nir_cdr_6(theLUN) endfor end else: print, 'second CASE statement got surprised' endcase free_lun, theLUN return, result end ;----------------------------------------------------------------------------- ; * concat_na_ddr_final - compiles all the sodium data for the whole ; mission phase. There are 9 macro types (41,65,66,67,68,85,87,91,92) ; that can be used in operations to measure sodium. This program calls a ; program that searches the cdr database by date for each macro. The ; program reorganizes the sodium geometry and spectral information from ; the cdrs into a summary file as described in the UVVS_CDR_DDR_SIS ; document. The total intensity and signal-to-noise over the sodium ; band is calculated and included in the DDRs. The data are written out ; to an IDL save file as an interim data product. ;----------------------------------------------------------------------------- pro concat_Na_DDR_final date1=['MASCS20110329','MASCS20110330','MASCS20110331','MASCS20110401','MASCS20110402','MASCS20110403','MASCS20110404','MASCS20110405'] date1=[date1,'MASCS20110406','MASCS20110407','MASCS20110408','MASCS20110409','MASCS20110410','MASCS20110411','MASCS20110412','MASCS20110413'] date1=[date1,'MASCS20110414','MASCS20110415','MASCS20110416','MASCS20110417','MASCS20110418','MASCS20110419','MASCS20110420','MASCS20110421'] date1=[date1,'MASCS20110422','MASCS20110423','MASCS20110424','MASCS20110425','MASCS20110426','MASCS20110427','MASCS20110428','MASCS20110429','MASCS20110430'] date1=[date1,'MASCS20110501','MASCS20110502','MASCS20110503','MASCS20110504','MASCS20110505','MASCS20110506','MASCS20110507'] date1=[date1,'MASCS20110508','MASCS20110509','MASCS20110510','MASCS20110511','MASCS20110512','MASCS20110513','MASCS20110514','MASCS20110515'] date1=[date1,'MASCS20110516','MASCS20110517','MASCS20110518','MASCS20110519','MASCS20110520','MASCS20110521','MASCS20110522','MASCS20110523'] date1=[date1,'MASCS20110524','MASCS20110525','MASCS20110526','MASCS20110527','MASCS20110528','MASCS20110529','MASCS20110530','MASCS20110531'] date1=[date1,'MASCS20110601','MASCS20110602','MASCS20110603','MASCS20110604','MASCS20110608','MASCS20110609'] date1=[date1,'MASCS20110610','MASCS20110611','MASCS20110612','MASCS20110613','MASCS20110614','MASCS20110615','MASCS20110616','MASCS20110617'] date1=[date1,'MASCS20110618','MASCS20110619','MASCS20110620','MASCS20110621','MASCS20110622','MASCS20110623','MASCS20110624','MASCS20110625'] date1=[date1,'MASCS20110626','MASCS20110627','MASCS20110628','MASCS20110629','MASCS20110630','MASCS20110701','MASCS20110702','MASCS20110703'] date1=[date1,'MASCS20110704','MASCS20110705','MASCS20110706','MASCS20110707','MASCS20110708','MASCS20110709','MASCS20110710','MASCS20110711'] date1=[date1,'MASCS20110712','MASCS20110713','MASCS20110714','MASCS20110715','MASCS20110716','MASCS20110717','MASCS20110718','MASCS20110719'] date1=[date1,'MASCS20110720','MASCS20110721','MASCS20110722','MASCS20110723','MASCS20110724','MASCS20110725','MASCS20110726','MASCS20110727'] date1=[date1,'MASCS20110728','MASCS20110729','MASCS20110731','MASCS20110801','MASCS20110802','MASCS20110803','MASCS20110804','MASCS20110805'] date1=[date1,'MASCS20110806','MASCS20110807','MASCS20110808','MASCS20110809','MASCS20110810','MASCS20110811','MASCS20110812','MASCS20110813'] date1=[date1,'MASCS20110814','MASCS20110815','MASCS20110816','MASCS20110817','MASCS20110818','MASCS20110819','MASCS20110820','MASCS20110821'] date1=[date1,'MASCS20110822','MASCS20110823','MASCS20110824','MASCS20110825','MASCS20110826','MASCS20110827','MASCS20110828','MASCS20110829'] date1=[date1,'MASCS20110830','MASCS20110831','MASCS20110901','MASCS20110902','MASCS20110903','MASCS20110904','MASCS20110905','MASCS20110906'] date1=[date1,'MASCS20110907','MASCS20110908','MASCS20110909','MASCS20110910','MASCS20110911','MASCS20110912','MASCS20110913','MASCS20110914'] date1=[date1,'MASCS20110915','MASCS20110916'] date1=[date1,'MASCS20110917','MASCS20110918','MASCS20110919','MASCS20110920','MASCS20110921','MASCS20110922','MASCS20110923','MASCS20110924'] date1=[date1,'MASCS20110925','MASCS20110926','MASCS20110927','MASCS20110928','MASCS20110929','MASCS20110930'] date1=[date1,'MASCS20111001','MASCS20111002','MASCS20111003','MASCS20111004','MASCS20111005','MASCS20111006','MASCS20111007','MASCS20111008'] date1=[date1,'MASCS20111009','MASCS20111010','MASCS20111011','MASCS20111012','MASCS20111013','MASCS20111014','MASCS20111015','MASCS20111016'] date1=[date1,'MASCS20111017','MASCS20111018','MASCS20111019','MASCS20111020','MASCS20111021','MASCS20111022','MASCS20111023','MASCS20111024'] date1=[date1,'MASCS20111025','MASCS20111026','MASCS20111027','MASCS20111028','MASCS20111029','MASCS20111030','MASCS20111031'] date1=[date1,'MASCS20111101','MASCS20111102','MASCS20111103','MASCS20111104','MASCS20111105','MASCS20111106','MASCS20111107'] date1=[date1,'MASCS20111108','MASCS20111109','MASCS20111110','MASCS20111111','MASCS20111112','MASCS20111113','MASCS20111114','MASCS20111115'] date1=[date1,'MASCS20111116','MASCS20111117','MASCS20111118','MASCS20111119','MASCS20111120','MASCS20111121','MASCS20111122','MASCS20111123'] date1=[date1,'MASCS20111124','MASCS20111125','MASCS20111126','MASCS20111127','MASCS20111128','MASCS20111129','MASCS20111130'] date1=[date1,'MASCS20111201','MASCS20111202','MASCS20111203','MASCS20111204','MASCS20111205','MASCS20111206','MASCS20111207'] date1=[date1,'MASCS20111208','MASCS20111209','MASCS20111210','MASCS20111211','MASCS20111212','MASCS20111213','MASCS20111214','MASCS20111215'] date1=[date1,'MASCS20111216','MASCS20111217','MASCS20111218','MASCS20111219','MASCS20111220','MASCS20111221','MASCS20111222','MASCS20111223'] date1=[date1,'MASCS20111224','MASCS20111225','MASCS20111226','MASCS20111227','MASCS20111228','MASCS20111229','MASCS20111230','MASCS20111231'] date1=[date1,'MASCS20120101','MASCS20120102','MASCS20120103','MASCS20120104','MASCS20120105','MASCS20120106','MASCS20120107'] date1=[date1,'MASCS20120108','MASCS20120109','MASCS20120110','MASCS20120111','MASCS20120112','MASCS20120113','MASCS20120114','MASCS20120115'] date1=[date1,'MASCS20120116','MASCS20120117','MASCS20120118','MASCS20120119','MASCS20120120','MASCS20120121','MASCS20120122','MASCS20120123'] date1=[date1,'MASCS20120124','MASCS20120125','MASCS20120126','MASCS20120127','MASCS20120128','MASCS20120129','MASCS20120130','MASCS20120131'] date1=[date1,'MASCS20120201','MASCS20120202','MASCS20120203','MASCS20120204','MASCS20120205','MASCS20120206','MASCS20120207'] date1=[date1,'MASCS20120208','MASCS20120209','MASCS20120210','MASCS20120211','MASCS20120212','MASCS20120213','MASCS20120214','MASCS20120215'] date1=[date1,'MASCS20120216','MASCS20120217','MASCS20120218','MASCS20120219','MASCS20120220','MASCS20120221','MASCS20120222','MASCS20120223'] date1=[date1,'MASCS20120224','MASCS20120225','MASCS20120226','MASCS20120227','MASCS20120228','MASCS20120229','MASCS20120301','MASCS20120302'] date1=[date1,'MASCS20120303','MASCS20120304'] ;XM dates date2=['MASCS20120302','MASCS20120303','MASCS20120304'] date2=[date2,'MASCS20120424','MASCS20120425','MASCS20120426'] date2=[date2,'MASCS20120427','MASCS20120428','MASCS20120429','MASCS20120430','MASCS20120501','MASCS20120502','MASCS20120503','MASCS20120504'] date2=[date2,'MASCS20120505','MASCS20120506','MASCS20120507','MASCS20120508','MASCS20120509','MASCS20120510','MASCS20120511','MASCS20120512'] date2=[date2,'MASCS20120513','MASCS20120514','MASCS20120515','MASCS20120516','MASCS20120517','MASCS20120518','MASCS20120519','MASCS20120520'] date2=[date2,'MASCS20120521','MASCS20120522','MASCS20120523','MASCS20120524','MASCS20120525','MASCS20120526','MASCS20120527'] date2=[date2,'MASCS20120528','MASCS20120529','MASCS20120530', 'MASCS20120531','MASCS20120601','MASCS20120602','MASCS20120603','MASCS20120604'] date2=[date2,'MASCS20120605','MASCS20120606','MASCS20120607','MASCS20120608','MASCS20120609','MASCS20120610','MASCS20120611','MASCS20120612'] date2=[date2,'MASCS20120613','MASCS20120614','MASCS20120615','MASCS20120616','MASCS20120617','MASCS20120618','MASCS20120619','MASCS20120620'] date2=[date2,'MASCS20120621','MASCS20120622','MASCS20120623','MASCS20120624','MASCS20120625','MASCS20120626','MASCS20120627','MASCS20120628'] date2=[date2,'MASCS20120629','MASCS20120630','MASCS20120701','MASCS20120702','MASCS20120703','MASCS20120704','MASCS20120705','MASCS20120706'] date2=[date2,'MASCS20120707','MASCS20120708','MASCS20120709','MASCS20120710','MASCS20120711','MASCS20120712','MASCS20120713','MASCS20120714'] date2=[date2,'MASCS20120715','MASCS20120716','MASCS20120717','MASCS20120718','MASCS20120719','MASCS20120720','MASCS20120721','MASCS20120722'] date2=[date2,'MASCS20120723','MASCS20120724','MASCS20120725','MASCS20120726','MASCS20120727','MASCS20120728','MASCS20120729','MASCS20120730'] date2=[date2,'MASCS20120731','MASCS20120801','MASCS20120802','MASCS20120803','MASCS20120804','MASCS20120805','MASCS20120806','MASCS20120807'] date2=[date2,'MASCS20120808','MASCS20120809','MASCS20120810','MASCS20120811','MASCS20120812','MASCS20120813','MASCS20120814','MASCS20120815'] date2=[date2,'MASCS20120816','MASCS20120817','MASCS20120818','MASCS20120819','MASCS20120820','MASCS20120821','MASCS20120822','MASCS20120823'] date2=[date2,'MASCS20120824','MASCS20120825', 'MASCS20120826','MASCS20120827','MASCS20120828','MASCS20120829','MASCS20120830','MASCS20120831'] date2=[date2,'MASCS20120901','MASCS20120902','MASCS20120903','MASCS20120904','MASCS20120905','MASCS20120906','MASCS20120907','MASCS20120908'] date2=[date2,'MASCS20120909','MASCS20120910','MASCS20120911','MASCS20120912','MASCS20120913','MASCS20120914','MASCS20120915','MASCS20120916'] date2=[date2,'MASCS20120917','MASCS20120918','MASCS20120919','MASCS20120922','MASCS20120923','MASCS20120924'] date2=[date2,'MASCS20120925','MASCS20120926','MASCS20120927','MASCS20120928','MASCS20120929','MASCS20120930','MASCS20121001','MASCS20121002'] date2=[date2,'MASCS20121003','MASCS20121004','MASCS20121005','MASCS20121006','MASCS20121007','MASCS20121008','MASCS20121009','MASCS20121010'] date2=[date2,'MASCS20121011','MASCS20121012','MASCS20121013','MASCS20121014','MASCS20121015','MASCS20121016','MASCS20121017','MASCS20121018'] date2=[date2,'MASCS20121019','MASCS20121020','MASCS20121021','MASCS20121022','MASCS20121023','MASCS20121024','MASCS20121025','MASCS20121026'] date2=[date2,'MASCS20121027','MASCS20121028','MASCS20121029','MASCS20121030','MASCS20121031','MASCS20121101','MASCS20121102','MASCS20121103'] date2=[date2,'MASCS20121104','MASCS20121105','MASCS20121106','MASCS20121107','MASCS20121108','MASCS20121109','MASCS20121110','MASCS20121111'] date2=[date2,'MASCS20121112','MASCS20121113','MASCS20121114','MASCS20121115','MASCS20121116','MASCS20121117','MASCS20121118','MASCS20121119'] date2=[date2,'MASCS20121120','MASCS20121121','MASCS20121122','MASCS20121123','MASCS20121124','MASCS20121125','MASCS20121126','MASCS20121127'] date2=[date2,'MASCS20121128','MASCS20121129','MASCS20121130','MASCS20121201','MASCS20121202','MASCS20121203','MASCS20121204','MASCS20121205'] date2=[date2,'MASCS20121206','MASCS20121207','MASCS20121208','MASCS20121209','MASCS20121210','MASCS20121211','MASCS20121212','MASCS20121213'] date2=[date2,'MASCS20121214','MASCS20121215','MASCS20121216','MASCS20121217','MASCS20121218','MASCS20121219','MASCS20121220','MASCS20121221'] date2=[date2,'MASCS20121222','MASCS20121223','MASCS20121224','MASCS20121225','MASCS20121226','MASCS20121227','MASCS20121228','MASCS20121229'] date2=[date2,'MASCS20121230','MASCS20121231','MASCS20130101','MASCS20130102','MASCS20130103','MASCS20130104','MASCS20130105','MASCS20130106'] date2=[date2,'MASCS20130107','MASCS20130108','MASCS20130109','MASCS20130110','MASCS20130111','MASCS20130112','MASCS20130113','MASCS20130114'] date2=[date2,'MASCS20130115','MASCS20130116','MASCS20130117','MASCS20130118','MASCS20130119','MASCS20130120','MASCS20130121','MASCS20130122'] date2=[date2,'MASCS20130123','MASCS20130124','MASCS20130125','MASCS20130126','MASCS20130127','MASCS20130128','MASCS20130129','MASCS20130130'] date2=[date2,'MASCS20130131','MASCS20130201','MASCS20130202','MASCS20130203','MASCS20130204','MASCS20130205','MASCS20130206','MASCS20130207'] date2=[date2,'MASCS20130208','MASCS20130209','MASCS20130210','MASCS20130211','MASCS20130212','MASCS20130213','MASCS20130214','MASCS20130215','MASCS20130216','MASCS20130217'] date3=['MASCS20130216','MASCS20130217','MASCS20130218','MASCS20130219','MASCS20130220','MASCS20130221','MASCS20130222','MASCS20130223'] date3=[date3,'MASCS20130224','MASCS20130225','MASCS20130226','MASCS20130227','MASCS20130228'] date3=[date3,'MASCS20130301','MASCS20130302','MASCS20130303','MASCS20130304','MASCS20130305','MASCS20130306','MASCS20130307'] date3=[date3,'MASCS20130308','MASCS20130309','MASCS20130310','MASCS20130311','MASCS20130312','MASCS20130313','MASCS20130314','MASCS20130315'] date3=[date3,'MASCS20130316','MASCS20130317'] ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Updated 11/2014 to include XM2 data ----AWM ;XM2 date3=[date3,'MASCS20130318','MASCS20130319','MASCS20130320','MASCS20130321','MASCS20130322','MASCS20130323','MASCS20130324','MASCS20130325'] date3=[date3,'MASCS20130326','MASCS20130327','MASCS20130328','MASCS20130329','MASCS20130330','MASCS20130331','MASCS20130401','MASCS20130402'] date3=[date3,'MASCS20130403','MASCS20130404','MASCS20130405','MASCS20130406','MASCS20130407','MASCS20130408','MASCS20130409','MASCS20130410'] date3=[date3,'MASCS20130411','MASCS20130412','MASCS20130413','MASCS20130414','MASCS20130415','MASCS20130416','MASCS20130417','MASCS20130418'] date3=[date3,'MASCS20130419','MASCS20130420','MASCS20130421','MASCS20130422','MASCS20130423'];,'MASCS20130424','MASCS20130425'] date3=[date3,'MASCS20130426','MASCS20130427','MASCS20130428','MASCS20130429','MASCS20130430','MASCS20130501','MASCS20130502','MASCS20130503','MASCS20130504'] date3=[date3,'MASCS20130505','MASCS20130506','MASCS20130507','MASCS20130508','MASCS20130509','MASCS20130510','MASCS20130511','MASCS20130512'] date3=[date3,'MASCS20130513','MASCS20130514','MASCS20130515','MASCS20130516','MASCS20130517','MASCS20130518','MASCS20130519','MASCS20130520'] date3=[date3,'MASCS20130521','MASCS20130522','MASCS20130523','MASCS20130524','MASCS20130525','MASCS20130526','MASCS20130527'] date3=[date3,'MASCS20130528','MASCS20130529','MASCS20130530','MASCS20130531','MASCS20130601','MASCS20130602','MASCS20130603','MASCS20130604'] date3=[date3,'MASCS20130605','MASCS20130606','MASCS20130607','MASCS20130608','MASCS20130609','MASCS20130610','MASCS20130611','MASCS20130612'] date3=[date3,'MASCS20130613','MASCS20130614','MASCS20130615','MASCS20130616','MASCS20130617','MASCS20130618','MASCS20130619','MASCS20130620'] date3=[date3,'MASCS20130621','MASCS20130622','MASCS20130623','MASCS20130624','MASCS20130625','MASCS20130626','MASCS20130627','MASCS20130628'] date3=[date3,'MASCS20130629','MASCS20130630','MASCS20130701','MASCS20130702','MASCS20130703','MASCS20130704','MASCS20130705','MASCS20130706'] date3=[date3,'MASCS20130707','MASCS20130708','MASCS20130709','MASCS20130710','MASCS20130711','MASCS20130712','MASCS20130713','MASCS20130714'] date3=[date3,'MASCS20130715','MASCS20130716','MASCS20130717','MASCS20130718','MASCS20130719','MASCS20130720','MASCS20130721','MASCS20130722'] date3=[date3,'MASCS20130723','MASCS20130724','MASCS20130725','MASCS20130726','MASCS20130727','MASCS20130728','MASCS20130729','MASCS20130730'] date3=[date3,'MASCS20130731','MASCS20130801','MASCS20130802','MASCS20130803','MASCS20130804','MASCS20130805','MASCS20130806','MASCS20130807'] date3=[date3,'MASCS20130808','MASCS20130809','MASCS20130810','MASCS20130811','MASCS20130812','MASCS20130813','MASCS20130814','MASCS20130815'] date3=[date3,'MASCS20130816','MASCS20130817','MASCS20130818','MASCS20130819','MASCS20130822','MASCS20130823'] ;'MASCS20130820','MASCS20130821', date3=[date3,'MASCS20130824','MASCS20130825','MASCS20130826','MASCS20130827','MASCS20130828','MASCS20130829','MASCS20130830','MASCS20130831'] date3=[date3,'MASCS20130901','MASCS20130902','MASCS20130903','MASCS20130904'];,'MASCS20130905','MASCS20130906','MASCS20130907','MASCS20130908'] ;date=[date,'MASCS20130909','MASCS20130910','MASCS20130911','MASCS20130912','MASCS20130913','MASCS20130914','MASCS20130915','MASCS20130916'] ;date=[date,'MASCS20130917','MASCS20130918','MASCS20130919','MASCS20130920','MASCS20130921','MASCS20130922','MASCS20130923','MASCS20130924'] ;date=[date,'MASCS20130925','MASCS20130926','MASCS20130927','MASCS20130928','MASCS20130929','MASCS20130930','MASCS20131001','MASCS20131002'] ;date=[date,'MASCS20131003','MASCS20131004','MASCS20131005','MASCS20131006','MASCS20131007','MASCS20131008','MASCS20131009','MASCS20131010'] ;date=[date,'MASCS20131011','MASCS20131012','MASCS20131013','MASCS20131014','MASCS20131015','MASCS20131016','MASCS20131017','MASCS20131018'] ;date=[date,'MASCS20131019','MASCS20131020','MASCS20131021','MASCS20131022','MASCS20131023','MASCS20131024','MASCS20131025','MASCS20131026'] ;date=[date,'MASCS20131027','MASCS20131028','MASCS20131029','MASCS20131030','MASCS20131031','MASCS20131101','MASCS20131102','MASCS20131103'] ;date=[date,'MASCS20131104','MASCS20131105','MASCS20131106','MASCS20131107','MASCS20131108','MASCS20131109','MASCS20131110','MASCS20131111'] ;date=[date,'MASCS20131112','MASCS20131113','MASCS20131114','MASCS20131115','MASCS20131116','MASCS20131117','MASCS20131118','MASCS20131119'] ;date=[date,'MASCS20131120','MASCS20131121','MASCS20131122', date3=[date3,'MASCS20131123','MASCS20131124','MASCS20131125','MASCS20131126','MASCS20131127'] date3=[date3,'MASCS20131128','MASCS20131129','MASCS20131130','MASCS20131201','MASCS20131202','MASCS20131203','MASCS20131204','MASCS20131205'] date3=[date3,'MASCS20131206','MASCS20131207','MASCS20131208','MASCS20131209','MASCS20131210','MASCS20131211','MASCS20131212','MASCS20131213'] date3=[date3,'MASCS20131214','MASCS20131215','MASCS20131216','MASCS20131217','MASCS20131218','MASCS20131219','MASCS20131220','MASCS20131221'] date3=[date3,'MASCS20131222','MASCS20131223','MASCS20131224','MASCS20131225','MASCS20131226','MASCS20131227','MASCS20131228','MASCS20131229'] date3=[date3,'MASCS20131230','MASCS20131231','MASCS20140101','MASCS20140102','MASCS20140103','MASCS20140104','MASCS20140105','MASCS20140106'] date3=[date3,'MASCS20140107','MASCS20140108','MASCS20140109','MASCS20140110','MASCS20140111','MASCS20140112','MASCS20140113','MASCS20140114'] date3=[date3,'MASCS20140115','MASCS20140116','MASCS20140117','MASCS20140118','MASCS20140119','MASCS20140120','MASCS20140121','MASCS20114122'] date3=[date3,'MASCS20140123','MASCS20140124','MASCS20140125','MASCS20140126','MASCS20140127','MASCS20140128','MASCS20140129','MASCS20140130'] date3=[date3,'MASCS20140131','MASCS20140201','MASCS20140202','MASCS20140203','MASCS20140204','MASCS20140205','MASCS20140206','MASCS20140207'] date4=['MASCS20140202','MASCS20140203','MASCS20140204','MASCS20140205','MASCS20140206','MASCS20140207'] date4=[date4,'MASCS20140208','MASCS20140209','MASCS20140210','MASCS20140211','MASCS20140212','MASCS20140213','MASCS20140214','MASCS20140215'] date4=[date4,'MASCS20140216','MASCS20140217','MASCS20140218','MASCS20140219','MASCS20140220','MASCS20140221','MASCS20140222','MASCS20140223'] date4=[date4,'MASCS20140224','MASCS20140225','MASCS20140226','MASCS20140227','MASCS20140228'] date4=[date4,'MASCS20140301','MASCS20140302','MASCS20140303','MASCS20140304','MASCS20140305','MASCS20140306','MASCS20140307'] date4=[date4,'MASCS20140308','MASCS20140309','MASCS20140310','MASCS20140311','MASCS20140312','MASCS20140313','MASCS20140314','MASCS20140315'] date4=[date4,'MASCS20140316','MASCS20140317'] ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Updated 11/2015 to include XM3 data ----AWM ;XM3 date4=[date4,'MASCS20140318','MASCS20140319','MASCS20140320','MASCS20140321','MASCS20140322','MASCS20140323','MASCS20140324','MASCS20140325'] date4=[date4,'MASCS20140326','MASCS20140327','MASCS20140328','MASCS20140329','MASCS20140330','MASCS20140331','MASCS20140401','MASCS20140402'] date4=[date4,'MASCS20140403','MASCS20140404','MASCS20140405','MASCS20140406','MASCS20140407','MASCS20140408','MASCS20140409','MASCS20140410'] date4=[date4,'MASCS20140411','MASCS20140412','MASCS20140414','MASCS20140414','MASCS20140415','MASCS20140416','MASCS20140417','MASCS20140418'] date4=[date4,'MASCS20140419','MASCS20140420','MASCS20140421','MASCS20140422','MASCS20140423','MASCS20140424','MASCS20140425'] date4=[date4,'MASCS20140426','MASCS20140427','MASCS20140428','MASCS20140429','MASCS20140430','MASCS20140501','MASCS20140502','MASCS20140503','MASCS20140504'] date4=[date4,'MASCS20140505','MASCS20140506','MASCS20140507','MASCS20140508','MASCS20140509','MASCS20140510','MASCS20140511','MASCS20140512'] date4=[date4,'MASCS20140514','MASCS20140514','MASCS20140515','MASCS20140516','MASCS20140517','MASCS20140518','MASCS20140519','MASCS20140520'] date4=[date4,'MASCS20140521','MASCS20140522','MASCS20140523','MASCS20140524','MASCS20140525','MASCS20140526','MASCS20140527'] date4=[date4,'MASCS20140528','MASCS20140529','MASCS20140530','MASCS20140531','MASCS20140601','MASCS20140602','MASCS20140603','MASCS20140604'] date4=[date4,'MASCS20140605','MASCS20140606','MASCS20140607','MASCS20140608','MASCS20140609','MASCS20140610','MASCS20140611','MASCS20140612'] date4=[date4,'MASCS20140614','MASCS20140614','MASCS20140615','MASCS20140616','MASCS20140617','MASCS20140618','MASCS20140619','MASCS20140620'] date4=[date4,'MASCS20140621','MASCS20140622','MASCS20140623','MASCS20140624','MASCS20140625','MASCS20140626','MASCS20140627','MASCS20140628'] date4=[date4,'MASCS20140629','MASCS20140630','MASCS20140701','MASCS20140702','MASCS20140703','MASCS20140704','MASCS20140705','MASCS20140706'] date4=[date4,'MASCS20140707','MASCS20140708','MASCS20140709','MASCS20140710','MASCS20140711','MASCS20140712','MASCS20140713','MASCS20140714'] date4=[date4,'MASCS20140715','MASCS20140716','MASCS20140717','MASCS20140718','MASCS20140719','MASCS20140720','MASCS20140721','MASCS20140722'] date4=[date4,'MASCS20140723','MASCS20140724','MASCS20140725','MASCS20140726','MASCS20140727','MASCS20140728','MASCS20140729','MASCS20140730'] date4=[date4,'MASCS20140731','MASCS20140801','MASCS20140802','MASCS20140803','MASCS20140804','MASCS20140805','MASCS20140806','MASCS20140807'] date4=[date4,'MASCS20140808','MASCS20140809','MASCS20140810','MASCS20140811','MASCS20140812','MASCS20140813','MASCS20140814','MASCS20140815'] date4=[date4,'MASCS20140816','MASCS20140817','MASCS20140818','MASCS20140819','MASCS20140820','MASCS20140821','MASCS20140822','MASCS20140823'] ;, date4=[date4,'MASCS20140824','MASCS20140825','MASCS20140826','MASCS20140827','MASCS20140828','MASCS20140829','MASCS20140830','MASCS20140831'] ;date=[date,'MASCS20140901','MASCS20140902','MASCS20140903','MASCS20140904'] date4=[date4,'MASCS20140905','MASCS20140906','MASCS20140907','MASCS20140908'] date4=[date4,'MASCS20140909','MASCS20140910','MASCS20140911','MASCS20140912','MASCS20140913','MASCS20140914','MASCS20140915','MASCS20140916'] date4=[date4,'MASCS20140917','MASCS20140918','MASCS20140919','MASCS20140920','MASCS20140921','MASCS20140922','MASCS20140923','MASCS20140924'] date4=[date4,'MASCS20140925','MASCS20140926','MASCS20140927','MASCS20140928','MASCS20140929','MASCS20140930','MASCS20141001','MASCS20141002'] date4=[date4,'MASCS20141003','MASCS20141004','MASCS20141005','MASCS20141006','MASCS20141007','MASCS20141008','MASCS20141009','MASCS20141010'] date4=[date4,'MASCS20141011','MASCS20141012','MASCS20141013','MASCS20141014','MASCS20141015','MASCS20141016','MASCS20141017','MASCS20141018'] date4=[date4,'MASCS20141019','MASCS20141020','MASCS20141021','MASCS20141022','MASCS20141023','MASCS20141024','MASCS20141025','MASCS20141026'] date4=[date4,'MASCS20141027','MASCS20141028','MASCS20141029','MASCS20141030','MASCS20141031','MASCS20141101','MASCS20141102','MASCS20141103'] date4=[date4,'MASCS20141104','MASCS20141105','MASCS20141106','MASCS20141107','MASCS20141108','MASCS20141109','MASCS20141110','MASCS20141111'] date4=[date4,'MASCS20141112','MASCS20141113','MASCS20141114','MASCS20141115','MASCS20141116','MASCS20141117','MASCS20141118','MASCS20141119'] date4=[date4,'MASCS20141120','MASCS20141121','MASCS20141122'] date4=[date4,'MASCS20141123','MASCS20141124','MASCS20141125','MASCS20141126','MASCS20141127'] date4=[date4,'MASCS20141128','MASCS20141129','MASCS20141130','MASCS20141201','MASCS20141202','MASCS20141203'];,'MASCS20141204',] date4=[date4,'MASCS20141205','MASCS20141206','MASCS20141207','MASCS20141208','MASCS20141209','MASCS20141210','MASCS20141211','MASCS20141212'] ;date=[date,'MASCS20141213','MASCS20141214','MASCS20141215','MASCS20141216] date4=[date4,'MASCS20141217','MASCS20141218','MASCS20141219','MASCS20141220','MASCS20141221'] date4=[date4,'MASCS20141222','MASCS20141223','MASCS20141224','MASCS20141225','MASCS20141226','MASCS20141227','MASCS20141228','MASCS20141229'] date4=[date4,'MASCS20141230','MASCS20141231','MASCS20150101','MASCS20150102','MASCS20150103','MASCS20150104','MASCS20150105','MASCS20150106'] date4=[date4,'MASCS20150107','MASCS20150108','MASCS20150109','MASCS20150110','MASCS20150111','MASCS20150112','MASCS20150113','MASCS20150114'] date4=[date4,'MASCS20150115','MASCS20150116','MASCS20150117','MASCS20150118','MASCS20150119','MASCS20150120','MASCS20150121','MASCS20115122'] date5=['MASCS20150120','MASCS20150121','MASCS20115122'] date5=[date5,'MASCS20150123','MASCS20150124','MASCS20150125','MASCS20150126','MASCS20150127','MASCS20150128','MASCS20150129','MASCS20150130'] date5=[date5,'MASCS20150131','MASCS20150201','MASCS20150202','MASCS20150203','MASCS20150204','MASCS20150205','MASCS20150206','MASCS20150207'] date5=[date5,'MASCS20150208','MASCS20150209','MASCS20150210','MASCS20150211','MASCS20150212','MASCS20150213','MASCS20150214','MASCS20150215'] date5=[date5,'MASCS20150216','MASCS20150217','MASCS20150218','MASCS20150219','MASCS20150220','MASCS20150221','MASCS20150222','MASCS20150223'] date5=[date5,'MASCS20150224','MASCS20150225','MASCS20150226','MASCS20150227','MASCS20150228'] date5=[date5,'MASCS20150301','MASCS20150302','MASCS20150303','MASCS20150304','MASCS20150305','MASCS20150306','MASCS20150307'] date5=[date5,'MASCS20150308','MASCS20150309','MASCS20150310','MASCS20150311','MASCS20150312','MASCS20150313','MASCS20150314','MASCS20150315'] date5=[date5,'MASCS20150316','MASCS20150317'] ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Updated 11/2015 to include XM4 data ----AWM ;XM4 date5=[date5,'MASCS20150318','MASCS20150319','MASCS20150320','MASCS20150321','MASCS20150322','MASCS20150323'];'MASCS20150324' date5=[date5,'MASCS20150325','MASCS20150326','MASCS20150327','MASCS20150328','MASCS20150329','MASCS20150330','MASCS20150331','MASCS20150401','MASCS20150402'] date5=[date5,'MASCS20150403','MASCS20150404','MASCS20150405','MASCS20150406','MASCS20150407','MASCS20150408','MASCS20150409','MASCS20150410'] date5=[date5,'MASCS20150411','MASCS20150412','MASCS20150413','MASCS20150414','MASCS20150415','MASCS20150416','MASCS20150417','MASCS20150418'] date5=[date5,'MASCS20150419','MASCS20150420','MASCS20150421','MASCS20150422','MASCS20150423','MASCS20150424','MASCS20150425'] date5=[date5,'MASCS20150426','MASCS20150427','MASCS20150428','MASCS20150429','MASCS20150430'] ;Updated in Oct 2013 ;not including 20110430 ;Added back in Aug 2013 ;not including 20110605, 20110606,20110607 due to CME ;not 20110911 ;Added back in Aug 2013 ;not including 20120305 and the rest of March because of high dark rate and CME activity ;not including 20120318 and the rest of March because of high dark rate ;There is a wavelength shift anomally that occurred from March 30th - April 22rd. This data should not be included in the summary file. ;exclude May 22 'MASCS20120523' ;;This is now included Decision March 2013 ;exclude May 29,30,31 'MASCS20120529','MASCS20120530' 'MASCS20120531', ;This is now included Decision March 2013 ;exclude Aug 25 26 27 'MASCS20120825' 'MASCS20120826','MASCS20120827' ;This is now included Decision March 2013 ;exclude sept 21 'MASCS20120920' 'MASCS20120921' ;exclude oct 17 'MASCS20121017' ;;This is now included Decision March 2013 ;Does not include April 24 and 25 due to CME ;Does not include August 20 and 21 due to CME ;Does not include Sept, 5 2013- Nov. 22nd 2013 due to wavelength shift merkelpath = '/Volumes/mascs_data/APL_Merkel/cdr_products/' merkelpath1 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm/' merkelpath2 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm2/' merkelpath3 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm3/' merkelpath4 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm4/' aplpath = 'E:/pipe_uvvs/cdr_rdr_products/mascs/data/CDR/ORB/' aplpath2 = 'E:/pipe_uvvs/cdr_rdr_products/mascs/data/CDR/OB2/' aplpath3 = 'E:/pipe_uvvs/cdr_rdr_products/mascs/data/CDR/OB3/' aplpath4 = 'E:/pipe_uvvs/cdr_rdr_products/mascs/data/CDR/OB4/' aplpath5 = 'E:/pipe_uvvs/cdr_rdr_products/mascs/data/CDR/OB5/' location = 1 ;1 is APL, 0 is Colorado if location eq 0 then path=merkelpath else path=aplpath if location eq 0 then path1=merkelpath1 else path2=aplpath2 if location eq 0 then path2=merkelpath2 else path3=aplpath3 if location eq 0 then path3=merkelpath3 else path4=aplpath4 if location eq 0 then path4=merkelpath4 else path5=aplpath5 ;print, 'assuming cdr products found in ',path for j=0,4 do begin ;; Loop over Earth years if j eq 0 then date=date1 if j eq 1 then date=date2 if j eq 2 then date = date3 if j eq 3 then date = date4 if j eq 4 then date =date5 dateind=n_elements(date) for dd=0,dateind-1 do begin if location eq 0 then begin xx=file_search(path+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*.sav') if xx(0) eq '' then xx=file_search(path1+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*.sav') if xx(0) eq '' then xx=file_search(path2+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*.sav') if xx(0) eq '' then xx=file_search(path3+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*.sav') if xx(0) eq '' then xx=file_search(path4+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*.sav') endif if location eq 1 then begin xx=file_search(path+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path2+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path3+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path4+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path5+date(dd)+'/UVVS/VIS/'+'*_{41,65,66,67,68,85,87,91,92}*_SCI.DAT') endif if xx(0) eq '' then begin print,'No files this day' print,date(dd) goto,skip endif for i=0,n_elements(xx)-1 do begin file=strpos(xx(i),'UVC') filenametop=strmid(xx(i),file,27) macrotop=strmid(xx(i),file+8,2) ; print, 'filenametop ',filenametop ; print, 'macrotop ',macrotop ; print, 'SODIUM' ;changed to case statements: RCE 11/09/2012 macro_int = fix(macrotop) case macro_int of 41: begin open_mac41_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 65: begin open_mac65_Na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 66: begin open_mac66_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 67: begin open_mac67_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 68: begin open_mac68_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 85: begin open_mac85_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 87: begin open_mac87_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 91: begin open_mac91_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end 92: begin open_mac92_na_DDR,xx(i),location,na_rad_kr6,na_rad_unc6,wvl6,na_tot_rad_kr6,na_tot_rad_unc6,midtime6,planet_sun_vector_tg6,planet_sc_vector_tg6,boresight_unit_vector_center_tg6,target_latitude_set6,target_longitude_set6,$ target_altitude_set6,subspacecraft_latitude6,subspacecraft_longitude6,subsolar_latitude6,subsolar_longitude6,step_utc_time6,jd_obs6,yd_obs6,ymd_obs6,filename6,macro6,$ scan_num6,boresight_unit_vector_c1_tg6,boresight_unit_vector_c2_tg6,true_anomaly6,slit6,obs_typ6,obs_typ_num6, obs_seq_index6,orig6,orbnum6 end endcase ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Concatenate data if dd eq 0 and i eq 0 then begin ;first date folder, first file midtime=[midtime6] planet_sun_vector_TG=[[planet_sun_vector_tg6]] planet_SC_vector_TG=[[planet_SC_vector_TG6]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG6]] boresight_unit_vector_c1_tg=[[boresight_unit_vector_c1_tg6]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg6]] target_latitude_set=[[target_latitude_set6]] target_longitude_set=[[target_longitude_set6]] target_altitude_set=[[target_altitude_set6]] subspacecraft_latitude=[subspacecraft_latitude6] subspacecraft_longitude=[subspacecraft_longitude6] subsolar_latitude=[subsolar_latitude6] subsolar_longitude=[subsolar_longitude6] true_anomaly=[true_anomaly6] step_utc_time=[step_utc_time6] macro=[macro6] filename=[filename6] scan_num=[scan_num6] obs_typ_num=[obs_typ_num6] obs_typ=[obs_typ6] obs_seq_index=[obs_seq_index6] slit=[slit6] orb_num=[orbnum6] orig=[[orig6]] jd_obs=[jd_obs6] yd_obs=[yd_obs6] ymd_obs=[[ymd_obs6]] na_rad_kr=[[na_rad_kr6]] na_rad_unc=[[na_rad_unc6]] wavelength=[[wvl6]] na_tot_rad_kr=[na_tot_rad_kr6] na_tot_rad_unc=[na_tot_rad_unc6] endif else begin ;N date folder, N file midtime=[midtime,midtime6] planet_sun_vector_TG=[[planet_sun_vector_tg],[planet_sun_vector_tg6]] planet_SC_vector_TG=[[planet_SC_vector_TG],[planet_SC_vector_TG6]] boresight_unit_vector_center_TG=[[boresight_unit_vector_center_TG],[boresight_unit_vector_center_TG6]] boresight_unit_vector_c1_tg=[[boresight_unit_vector_c1_tg],[boresight_unit_vector_c1_tg6]] boresight_unit_vector_c2_tg=[[boresight_unit_vector_c2_tg],[boresight_unit_vector_c2_tg6]] target_latitude_set=[[target_latitude_set],[target_latitude_set6]] target_longitude_set=[[target_longitude_set],[target_longitude_set6]] target_altitude_set=[[target_altitude_set],[target_altitude_set6]] subspacecraft_latitude=[subspacecraft_latitude,subspacecraft_latitude6] subspacecraft_longitude=[subspacecraft_longitude,subspacecraft_longitude6] subsolar_latitude=[subsolar_latitude,subsolar_latitude6] subsolar_longitude=[subsolar_longitude,subsolar_longitude6] true_anomaly=[true_anomaly,true_anomaly6] step_utc_time=[step_utc_time,step_utc_time6] macro=[macro,macro6] filename=[filename,filename6] scan_num=[scan_num,scan_num6] obs_typ_num=[obs_typ_num,obs_typ_num6] obs_typ=[obs_typ,obs_typ6] obs_seq_index=[obs_seq_index,obs_seq_index6] slit=[slit,slit6] orb_num=[orb_num,orbnum6] orig=[[orig],[orig6]] jd_obs=[jd_obs,jd_obs6] yd_obs=[yd_obs,yd_obs6] ymd_obs=[[ymd_obs],[ymd_obs6]] na_rad_kr=[[na_rad_kr],[na_rad_kr6]] na_rad_unc=[[na_rad_unc],[na_rad_unc6]] wavelength=[[wavelength],[wvl6]] na_tot_rad_kr=[na_tot_rad_kr,na_tot_rad_kr6] na_tot_rad_unc=[na_tot_rad_unc,na_tot_rad_unc6] endelse endfor skip: endfor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Make sure sorted by time index=sort(jd_obs) midtime=midtime(index) planet_sun_vector_TG=planet_sun_vector_tg(*,index) planet_SC_vector_TG=planet_SC_vector_TG(*,index) boresight_unit_vector_center_TG=boresight_unit_vector_center_TG(*,index) boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg(*,index) boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg(*,index) target_latitude_set=target_latitude_set(*,index) target_longitude_set=target_longitude_set(*,index) target_altitude_set=target_altitude_set(*,index) subspacecraft_latitude=subspacecraft_latitude(index) subspacecraft_longitude=subspacecraft_longitude(index) subsolar_latitude=subsolar_latitude(index) subsolar_longitude=subsolar_longitude(index) true_anomaly=true_anomaly(index) step_utc_time=step_utc_time(index) macro=macro(index) filename=filename(index) scan_num=scan_num(index) obs_typ_num=obs_typ_num(index) obs_typ=obs_typ(index) obs_seq_index=obs_seq_index(index) slit=slit(index) orb_num=orb_num(index) orig=orig(*,index) jd_obs=jd_obs(index) yd_obs=yd_obs(index) ymd_obs=ymd_obs(*,index) na_rad_kr=na_rad_kr(*,index) na_rad_unc=na_rad_unc(*,index) wavelength=wavelength(*,index) na_tot_rad_kr=na_tot_rad_kr(index) na_tot_rad_snr=na_tot_rad_unc(index) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Filter out bad scans ;index=where(na_rad_kr(6,*) gt -200 and na_rad_kr(0,*) gt -50 and na_rad_kr(16,*) lt 200 and na_rad_kr(16,*) gt -50) ;More extensive filtering added Aug. 2013 diff=orig(1,*)-orig(17,*) yy=where(orig(0,*) ne 0.00) yy2=where(orig(20,yy) ne 0.00) yy4=where(diff(yy(yy2)) lt 2e4 and diff(yy(yy2)) gt -2e4) ;to deal with large slant scans yy5=where(na_tot_rad_kr(yy(yy2(yy4))) gt -50) index2=yy(yy2(yy4(yy5))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; midtime=midtime(index2) planet_sun_vector_TG=planet_sun_vector_tg(*,index2) planet_SC_vector_TG=planet_SC_vector_TG(*,index2) boresight_unit_vector_center_TG=boresight_unit_vector_center_TG(*,index2) boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg(*,index2) boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg(*,index2) target_latitude_set=target_latitude_set(*,index2) target_longitude_set=target_longitude_set(*,index2) target_altitude_set=target_altitude_set(*,index2) subspacecraft_latitude=subspacecraft_latitude(index2) subspacecraft_longitude=subspacecraft_longitude(index2) subsolar_latitude=subsolar_latitude(index2) subsolar_longitude=subsolar_longitude(index2) true_anomaly=true_anomaly(index2) step_utc_time=step_utc_time(index2) macro=macro(index2) filename=filename(index2) scan_num=scan_num(index2) obs_typ_num=obs_typ_num(index2) obs_typ=obs_typ(index2) obs_seq_index=obs_seq_index(index2) slit=slit(index2) orb_num=orb_num(index2) jd_obs=jd_obs(index2) yd_obs=yd_obs(index2) ymd_obs=ymd_obs(*,index2) na_rad_kr=na_rad_kr(*,index2) na_rad_unc=na_rad_unc(*,index2) wavelength=wavelength(*,index2) na_tot_rad_kr=na_tot_rad_kr(index2) na_tot_rad_snr=na_tot_rad_snr(index2) ;Calculate solar local time loc=(subspacecraft_longitude-subsolar_longitude)/15.+12 kk=wherE(loc lt 0) kk2=wherE(loc gt 24) loc(kk2)=loc(kk2)-24 loc(kk)=loc(kk)+24 spacecraft_solar_localtime=loc loc2=(target_longitude_set(0,*)-subsolar_longitude)/15.+12 kk=wherE(loc2 lt 0) kk2=wherE(loc2 gt 24) loc2(kk2)=loc2(kk2)-24 loc2(kk)=loc2(kk)+24 Obs_solar_localtime=reform(loc2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;ORBIT NUMBER NOW CONTAINED IN CDR SO COMMENTING OUT THIS CODE AUG 2013 ;choose whether to dynamically create the orbit_utc start file or use an old one. ;RCE 11/09/2012 ;set flag below to 0 for LASP use ;dynamic_orbit = 1 ;if dynamic_orbit eq 1 then begin ;at APL, dynamically create the orbitstart sav file ; create_orbit_num_save_file ; restore,'Orbitstart_APL.sav' ;endif else begin ; restore,'/Users/merkel/Mercury/Orbit_FILES/NEW_DATA/CONCAT_FILES/Orbit_number/Orbitstart_created_Oct2012.sav' ; restore,'Orbitstart_created_Dec2012.sav' ;endelse ; ;tt=n_elements(orbit_number) ;orb_num=fltarr(n_elements(step_utc_time)) ;for yy=0,tt-2 do begin ; orb_ind=where(yd_obs ge yd_orb_start(yy) and yd_obs lt yd_orb_start(yy+1)) ; if orb_ind(0) ne -1 then orb_num(orb_ind)=orbit_number(yy) ;endfor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; spacecraft_altitude=sqrt(planet_sc_vector_tg(0,*)^2+planet_sc_vector_tg(1,*)^2+planet_sc_vector_tg(2,*)^2)-2440. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; yearind=j process_dayside_limb_final,midtime, planet_sun_vector_TG, planet_SC_vector_TG, boresight_unit_vector_center_TG, boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg, target_latitude_set,$ target_longitude_set, target_altitude_set, subspacecraft_latitude, subspacecraft_longitude, subsolar_latitude, subsolar_longitude, true_anomaly, step_utc_time, macro,$ filename, scan_num, obs_typ_num, obs_typ, obs_seq_index, slit, jd_obs, yd_obs, ymd_obs, na_rad_kr, na_rad_unc, wavelength, na_tot_rad_kr, na_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/NA,yearind process_night_sweeps_final,midtime, planet_sun_vector_TG, planet_SC_vector_TG, boresight_unit_vector_center_TG, boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg, target_latitude_set,$ target_longitude_set, target_altitude_set, subspacecraft_latitude, subspacecraft_longitude, subsolar_latitude, subsolar_longitude, true_anomaly, step_utc_time, macro,$ filename, scan_num, obs_typ_num, obs_typ, obs_seq_index, slit, jd_obs, yd_obs, ymd_obs, na_rad_kr, na_rad_unc, wavelength, na_tot_rad_kr, na_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/NA,yearind process_limb_drifts_final,midtime, planet_sun_vector_TG, planet_SC_vector_TG, boresight_unit_vector_center_TG, boresight_unit_vector_c1_tg, boresight_unit_vector_c2_tg, target_latitude_set,$ target_longitude_set, target_altitude_set, subspacecraft_latitude, subspacecraft_longitude, subsolar_latitude, subsolar_longitude, true_anomaly, step_utc_time, macro,$ filename, scan_num, obs_typ_num, obs_typ, obs_seq_index, slit, jd_obs, yd_obs, ymd_obs, na_rad_kr, na_rad_unc, wavelength, na_tot_rad_kr, na_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/NA,yearind endfor return end ;----------------------------------------------------------------------------- ; * process_dayside_limb_final - concatenates the calibrated data to create ; the UVVS dayside limb DDR for a given species in a given Mercury Year. ;----------------------------------------------------------------------------- PRO process_dayside_limb_final,midtime_tt, planet_sun_vector_tt, planet_SC_vector_tt, boresight_unit_vector_center_tt, boresight_unit_vector_c1_tt, boresight_unit_vector_c2_tt, target_latitude_set_tt,$ target_longitude_set_tt, target_altitude_set_tt, subspacecraft_latitude_tt, subspacecraft_longitude_tt, subsolar_latitude_tt, subsolar_longitude_tt, true_anomaly_tt, step_utc_time_tt, macro_num_tt,$ filename_tt, scan_num_tt, obs_typ_num_tt, obs_typ_tt, obs_seq_index_tt, slit_tt, jd_obs_tt, yd_obs_tt, ymd_obs_tt, rad_kr_tt, rad_unc_tt, wavelength_tt, tot_rad_kr_tt, $ tot_rad_snr_tt,obs_solar_localtime_tt,orb_num_tt,spacecraft_altitude_tt,spacecraft_solar_localtime_tt,NA=NA, MG=MG, CA=CA,yearind ;Updated 11/2014 to include XM2 data ----AWM ;Updated 11/2015 to include XM3/XM4 data ----AWM Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2554,2773,3037,3300,3562,3819,4073] ;Start orbits for Mercury year boundaries Myear_orb_end=[171,348,527,707,925,1189,1453,1717,1980,2244,2317,2772,3036,3299,3561,3818,4072,4110] ;End orbits for Mercury year boundaries ;1804 needs to be extended with XM2 is added ;Loop over mercury years if yearind eq 0 then start_ind=0 if yearind eq 1 then start_ind=4 if yearind eq 2 then start_ind=8 if yearind eq 3 then start_ind=12 if yearind eq 4 then start_ind=16 for i=start_ind,17 do begin obs_typ_i=where(obs_typ_num_tt eq 1 and orb_num_tt ge Myear_orb_start(i) and orb_num_tt le Myear_orb_end(i)) ; ; mercury year boundary orbit numbers based on TA ;UVVSDAYSIDEscan is assigned number 1 in open_mac##_NA_DDR.pro code. if obs_typ_i(0) eq -1 then goto,skip o_index=n_elements(obs_typ_i) utc_time=fltarr(17,o_index) radiance_kr=fltarr(25,o_index) radiance_snr=fltarr(25,o_index) wavelength=fltarr(25,o_index) target_altitude=fltarr(3,o_index) target_altitude_set=target_altitude_set_tt(*,obs_typ_i) cdr_name=filename_tt(obs_typ_i) planet_sun_vector_tg=planet_sun_vector_tt(*,obs_typ_i) planet_sc_vector_tg=planet_sc_vector_tt(*,obs_typ_i) boresight_unit_vector_center_tg=boresight_unit_vector_center_tt(*,obs_typ_i) target_latitude=target_latitude_set_tt(0,obs_typ_i) target_longitude=target_longitude_set_tt(0,obs_typ_i) target_altitude(0,*)=target_altitude_set(0,*) for j=0,o_index-1 do begin target_altitude(1,j)=min(target_altitude_set(1:4,j)) target_altitude(2,j)=max(target_altitude_set(1:4,j)) endfor target_local_time=obs_solar_localtime_tt(obs_typ_i) subspacecraft_latitude=subspacecraft_latitude_tt(obs_typ_i) subspacecraft_longitude=subspacecraft_longitude_tt(obs_typ_i) spacecraft_local_time=spacecraft_solar_localtime_tt(obs_typ_i) subsolar_latitude=subsolar_latitude_tt(obs_typ_i) subsolar_longitude=subsolar_longitude_tt(obs_typ_i) planet_true_anomaly=true_anomaly_tt(obs_typ_i) orbit_number=orb_num_tt(obs_typ_i) mid_spectrum_time=midtime_tt(obs_typ_i) utc_time=byte(step_utc_time_tt(obs_typ_i)) total_radiance_kr=tot_rad_kr_tt(obs_typ_i) total_radiance_snr=tot_rad_snr_tt(obs_typ_i) slit_pos=slit_tt(obs_typ_i) observation_type= obs_typ_tt(obs_typ_i) obs_sequence_index= obs_seq_index_tt(obs_typ_i) spacecraft_altitude=spacecraft_altitude_tt(obs_typ_i) obs_typ_num=obs_typ_num_tt(obs_typ_i) if keyword_Set(NA) then begin wavelength(2:22,*)=wavelength_tt(*,obs_typ_i) radiance_kr(2:22,*)=rad_kr_tt(*,obs_typ_i) radiance_snr(2:22,*)=rad_unc_tt(*,obs_typ_i) endif if keyword_Set(MG) or keyword_set(CA) then begin wavelength(4:20,*)=wavelength_tt(*,obs_typ_i) radiance_kr(4:20,*)=rad_kr_tt(*,obs_typ_i) radiance_snr(4:20,*)=rad_unc_tt(*,obs_typ_i) endif ;;;Do I want to further filter out scans that intersect the surface??? ;Filter out scans that intersect the surface ;Added additional filtering on snr and total_radiance. These points are typically bad and outside of 3 sigma error. index=where(target_altitude(1,*) gt 0. and total_radiance_snr gt -3 and total_radiance_kr gt -2) cdr_name=cdr_name(index) planet_sun_vector_tg=planet_sun_vector_tg(*,index) planet_sc_vector_tg=planet_sc_vector_tg(*,index) boresight_unit_vector_center_tg=boresight_unit_vector_center_tg(*,index) target_latitude=target_latitude(index) target_longitude=target_longitude(index) target_altitude=target_altitude(*,index) target_local_time=target_local_time(index) subspacecraft_latitude=subspacecraft_latitude(index) subspacecraft_longitude=subspacecraft_longitude(index) spacecraft_local_time=spacecraft_local_time(index) subsolar_latitude=subsolar_latitude(index) subsolar_longitude=subsolar_longitude(index) planet_true_anomaly=planet_true_anomaly(index) orbit_number=orbit_number(index) mid_spectrum_time=mid_spectrum_time(index) utc_time=utc_time(*,index) wavelength=wavelength(*,index) radiance_kr=radiance_kr(*,index) radiance_snr=radiance_snr(*,index) total_radiance_kr=total_radiance_kr(index) total_radiance_snr=total_radiance_snr(index) slit_pos=slit_pos(index) observation_type= observation_type(index) obs_sequence_index= obs_sequence_index(index) spacecraft_altitude=spacecraft_altitude(index) obs_typ_num=obs_typ_num(index) ;Need to delete bad data for Mg afternoon low altitude data if keyword_set(MG) then begin tt=where(target_altitude(1,*) le 400 and target_local_time ge 5 and target_local_time le 19,complement=index2) ;radiance_kr(*,tt)=-999 ;radiance_snr(*,tt)=-999 ;total_radiance_kr(tt)=-999 ;total_radiance_snr(tt)=-999 cdr_name=cdr_name(index2) planet_sun_vector_tg=planet_sun_vector_tg(*,index2) planet_sc_vector_tg=planet_sc_vector_tg(*,index2) boresight_unit_vector_center_tg=boresight_unit_vector_center_tg(*,index2) target_latitude=target_latitude(index2) target_longitude=target_longitude(index2) target_altitude=target_altitude(*,index2) target_local_time=target_local_time(index2) subspacecraft_latitude=subspacecraft_latitude(index2) subspacecraft_longitude=subspacecraft_longitude(index2) spacecraft_local_time=spacecraft_local_time(index2) subsolar_latitude=subsolar_latitude(index2) subsolar_longitude=subsolar_longitude(index2) planet_true_anomaly=planet_true_anomaly(index2) orbit_number=orbit_number(index2) mid_spectrum_time=mid_spectrum_time(index2) utc_time=utc_time(*,index2) wavelength=wavelength(*,index2) radiance_kr=radiance_kr(*,index2) radiance_snr=radiance_snr(*,index2) total_radiance_kr=total_radiance_kr(index2) total_radiance_snr=total_radiance_snr(index2) slit_pos=slit_pos(index2) observation_type= observation_type(index2) obs_sequence_index= obs_sequence_index(index2) spacecraft_altitude=spacecraft_altitude(index2) obs_typ_num=obs_typ_num(index2) endif ;;;;;;;;;;Now loop over orbit number fine tune the orbit sequence number for j=Myear_orb_start(i),Myear_orb_end(i) do begin orbind=where(orbit_number eq j) if orbind(0) ne -1 then begin obs_seq=obs_sequence_index(orbind) orbi=n_elements(orbind) sh=abs(shift(target_local_time(orbind),1)-target_local_time(orbind)) shif=where(sh gt .2) if shif(0) ne -1 then begin for k=0,n_elements(shif)-2 do obs_seq(shif(k):shif(k+1)-1)=reverse(findgen(shif(k+1)-shif(k))+1) obs_seq(shif(k):orbi-1)=reverse(findgen(orbi-shif(k))+1) if shif(0) ne 0 then obs_seq(0:shif(0)-1)=reverse(findgen(shif(0))+1) endif else begin obs_seq=reverse(findgen(orbi)+1) endelse obs_sequence_index(orbind)=obs_seq endif endfor if keyword_Set(NA) then filename='UD_0'+strcompress(i+1,/re)+'_LS_NA.sav' if keyword_Set(CA) then filename='UD_0'+strcompress(i+1,/re)+'_LS_CA.sav' if keyword_Set(MG) then filename='UD_0'+strcompress(i+1,/re)+'_LS_MG.sav' if i ge 9 then begin if keyword_Set(NA) then filename='UD_'+strcompress(i+1,/re)+'_LS_NA.sav' if keyword_Set(CA) then filename='UD_'+strcompress(i+1,/re)+'_LS_CA.sav' if keyword_Set(MG) then filename='UD_'+strcompress(i+1,/re)+'_LS_MG.sav' endif save,observation_type,cdr_name,obs_sequence_index,planet_sun_vector_tg,planet_sc_vector_tg, boresight_unit_vector_center_tg,target_latitude,$ target_longitude,target_altitude,target_local_time,subspacecraft_latitude,subspacecraft_longitude,spacecraft_altitude,spacecraft_local_time,$ subsolar_latitude,subsolar_longitude,planet_true_anomaly,orbit_number,mid_spectrum_time,utc_time,wavelength,radiance_kr,radiance_snr,$ total_radiance_kr,total_radiance_snr,slit_pos,filename=filename skip: endfor return end ;----------------------------------------------------------------------------- ; * process_limb_drifts_final - concatenates the calibrated data to create ; the UVVS limb drift DDR for a given species in a given Mercury Year. ;----------------------------------------------------------------------------- PRO process_limb_drifts_final,midtime_tt, planet_sun_vector_tt, planet_SC_vector_tt, boresight_unit_vector_center_tt, boresight_unit_vector_c1_tt, boresight_unit_vector_c2_tt, target_latitude_set_tt,$ target_longitude_set_tt, target_altitude_set_tt, subspacecraft_latitude_tt, subspacecraft_longitude_tt, subsolar_latitude_tt, subsolar_longitude_tt, true_anomaly_tt, step_utc_time_tt, macro_num_tt,$ filename_tt, scan_num_tt, obs_typ_num_tt, obs_typ_tt, obs_seq_index_tt, slit_tt, jd_obs_tt, yd_obs_tt, ymd_obs_tt, rad_kr_tt, rad_unc_tt, wavelength_tt, tot_rad_kr_tt, $ tot_rad_snr_tt,obs_solar_localtime_tt,orb_num_tt,spacecraft_altitude_tt,spacecraft_solar_localtime_tt,NA=NA,MG=MG,CA=CA,yearind ;Updated 11/2014 to include XM2 data ----AWM ;Updated 11/2015 to include XM3/XM4 data ----AWM Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2554,2773,3037,3300,3562,3819,4073] ;Start orbits for Mercury year boundaries Myear_orb_end=[171,348,527,707,925,1189,1453,1717,1980,2244,2317,2772,3036,3299,3561,3818,4072,4110] ;End orbits for Mercury year boundaries ;1804 needs to be extended with XM2 is added minalt_tt=fltarr(n_elements(obs_typ_num_tt)) for u=0,n_elements(obs_typ_num_tt)-1 do begin minalt_tt(u)=min(target_altitude_set_tt(*,u)) endfor if yearind eq 0 then start_ind=0 if yearind eq 1 then start_ind=4 if yearind eq 2 then start_ind=8 if yearind eq 3 then start_ind=12 if yearind eq 4 then start_ind=16 ;Loop over 9 mercury years for i=start_ind,17 do begin obs_typ_i=where(((obs_typ_num_tt eq 2 and obs_solar_localtime_tt gt 10.5 and obs_solar_localtime_tt lt 13.5 and minalt_tt lt 2500.) or obs_typ_num_tt eq 4 or obs_typ_num_tt eq 6 or obs_typ_num_tt eq 9) and orb_num_tt ge Myear_orb_start(i) and orb_num_tt le Myear_orb_end(i)) if obs_typ_i(0) eq -1 then goto, skip ;mercury year boundary orbit numbers based on TA ;UVVSEXONadir is assigned number 6 in open_mac##_NA_DDR.pro code. ;UVVSEXOStare is assigned number 4 in open_mac##_NA_DDR.pro code. ;UVVVLimbOpp is assigned number 2 in open_mac##_NA_DDR.pro code. ;UVVSNightColumn is assigned number 9 in open_mac##_NA_DDR.pro code. ;;Additional filtering on limb opportunities on local time and altitude ;; Only take subsolar point observations and altitudes less than 2500. ;Left in the sweeps that intersect the surface on the night side. o_index=n_elements(obs_typ_i) utc_time=fltarr(17,o_index) radiance_kr=fltarr(25,o_index) radiance_snr=fltarr(25,o_index) wavelength=fltarr(25,o_index) target_altitude=fltarr(3,o_index) target_altitude_set=target_altitude_set_tt(*,obs_typ_i) cdr_name=filename_tt(obs_typ_i) planet_sun_vector_tg=planet_sun_vector_tt(*,obs_typ_i) planet_sc_vector_tg=planet_sc_vector_tt(*,obs_typ_i) boresight_unit_vector_center_tg=boresight_unit_vector_center_tt(*,obs_typ_i) target_latitude=target_latitude_set_tt(0,obs_typ_i) target_longitude=target_longitude_set_tt(0,obs_typ_i) target_altitude(0,*)=target_altitude_set(0,*) for j=0,o_index-1 do begin target_altitude(1,j)=min(target_altitude_set(1:4,j)) target_altitude(2,j)=max(target_altitude_set(1:4,j)) endfor target_local_time=obs_solar_localtime_tt(obs_typ_i) subspacecraft_latitude=subspacecraft_latitude_tt(obs_typ_i) subspacecraft_longitude=subspacecraft_longitude_tt(obs_typ_i) spacecraft_local_time=spacecraft_solar_localtime_tt(obs_typ_i) subsolar_latitude=subsolar_latitude_tt(obs_typ_i) subsolar_longitude=subsolar_longitude_tt(obs_typ_i) planet_true_anomaly=true_anomaly_tt(obs_typ_i) orbit_number=orb_num_tt(obs_typ_i) mid_spectrum_time=midtime_tt(obs_typ_i) utc_time=byte(step_utc_time_tt(obs_typ_i)) total_radiance_kr=tot_rad_kr_tt(obs_typ_i) total_radiance_snr=tot_rad_snr_tt(obs_typ_i) slit_pos=slit_tt(obs_typ_i) observation_type= obs_typ_tt(obs_typ_i) obs_sequence_index= obs_seq_index_tt(obs_typ_i) spacecraft_altitude=spacecraft_altitude_tt(obs_typ_i) obs_typ_num=obs_typ_num_tt(obs_typ_i) minalt=minalt_tt(obs_typ_i) jd_obs=jd_obs_tt(obs_typ_i) yd_obs=yd_obs_tt(obs_typ_i) if keyword_Set(NA) then begin wavelength(2:22,*)=wavelength_tt(*,obs_typ_i) radiance_kr(2:22,*)=rad_kr_tt(*,obs_typ_i) radiance_snr(2:22,*)=rad_unc_tt(*,obs_typ_i) endif if keyword_Set(MG) or keyword_set(CA) then begin wavelength(4:20,*)=wavelength_tt(*,obs_typ_i) radiance_kr(4:20,*)=rad_kr_tt(*,obs_typ_i) radiance_snr(4:20,*)=rad_unc_tt(*,obs_typ_i) endif ;;;;;;;;;;Now loop over orbit number to re-index observation index ;;;;;;;;;;If statements test if the index should increase or decrease depending on which altitude is the lowest. ;;;;;Filter out limb opportunities that are not limb drifts ;;Filter out sequences with less than 8 observations ;;Filter out where the longitude is changing fast (so indicates sporatic observations) ;;Filter out sequences which double back on themselves. ;;Filter by local time (only take sequences that are near the subsolar point) for j=Myear_orb_start(i),Myear_orb_end(i) do begin orbind=where(orbit_number eq j) if orbind(0) ne -1 then begin obs_seq=obs_sequence_index(orbind) orbi=n_elements(orbind) shlong= abs(target_longitude(orbind)-shift(target_longitude(orbind), 1)) sh=obs_typ_num(orbind)-shift(obs_typ_num(orbind), 1) shif=where(sh ne 0) if shif(0) ne -1 then begin ;loops over different obs type in middle of array for k=0,n_elements(shif)-2 do begin indnum=shif(k+1)-shif(k) if target_altitude(1,orbind(shif(k))) ge target_altitude(1,orbind(shif(k+1))-1) then obs_seq(shif(k):shif(k+1)-1)=reverse(findgen(indnum)+1) if target_altitude(1,orbind(shif(k))) lt target_altitude(1,orbind(shif(k+1))-1) then obs_seq(shif(k):shif(k+1)-1)=(findgen(indnum)+1) if obs_typ_num(orbind(shif(k))) eq 2 then begin if indnum le 8 then begin obs_seq(shif(k):shif(k+1)-1)=fltarr(indnum) & goto,skip1 & endif if max(shlong(shif(k)+1:shif(k+1)-1)) gt 2 then obs_seq(shif(k):shif(k+1)-1)=fltarr(indnum) if (target_altitude(1,orbind(shif(k+1)-1)) gt target_altitude(1,orbind(shif(k)+indnum/2))) and $ (target_altitude(1,orbind(shif(k))) gt target_altitude(1,orbind(shif(k)+indnum/2))) then obs_seq(shif(k):shif(k+1)-1)=fltarr(indnum) skip1: endif endfor ;Handles end of array indnum=(orbi)-shif(k) if target_altitude(1,orbind(shif(k))) ge target_altitude(1,orbind(orbi-1)) then obs_seq(shif(k):orbi-1)=reverse(findgen(indnum)+1) if target_altitude(1,orbind(shif(k))) lt target_altitude(1,orbind(orbi-1)) then obs_seq(shif(k):orbi-1)=(findgen(indnum)+1) if obs_typ_num(orbind(shif(k))) eq 2 then begin if indnum le 8 then begin obs_seq(shif(k):orbi-1)=fltarr(indnum) & goto,skip2 & endif if (max(shlong(shif(k)+1:orbi-1)) gt 2) then obs_seq(shif(k):orbi-1)=fltarr(indnum) if (target_altitude(1,orbind(orbi-1)) gt target_altitude(1,orbind(shif(k)+indnum/2))) and $ (target_altitude(1,orbind(shif(k)) gt target_altitude(1,orbind(shif(k)+indnum/2)))) then obs_seq(shif(k):orbi-1)=fltarr(indnum) skip2: endif if shif(0) ne 0 then begin ;Handles beginning of array indnum=shif(0) if target_altitude(1,orbind(0)) ge target_altitude(1,orbind(shif(0)-1)) then obs_seq(0:shif(0)-1)=reverse(findgen(shif(0))+1) if target_altitude(1,orbind(0)) lt target_altitude(1,orbind(shif(0)-1)) then obs_seq(0:shif(0)-1)=(findgen(shif(0))+1) if obs_typ_num(orbind(0)) eq 2 then begin if indnum le 8 then begin obs_seq(0:shif(0)-1)=fltarr(indnum) & goto,skip3 & endif if (max(shlong(0:shif(0)-1)) gt 2) then obs_seq(0:shif(0)-1)=fltarr(indnum) if (target_altitude(1,orbind(shif(0)-1)) gt target_altitude(1,orbind(shif(0)-indnum/2))) and $ (target_altitude(1,orbind(0)) gt target_altitude(1,orbind(shif(0)-indnum/2))) then obs_seq(0:shif(0)-1)=fltarr(indnum) skip3: endif endif endif else begin ;Handles a single obs type in an orbit indnum=orbi if target_altitude(1,orbind(0)) ge target_altitude(1,orbind(orbi-1)) then obs_seq=reverse(findgen(orbi)+1) if target_altitude(1,orbind(0)) lt target_altitude(1,orbind(orbi-1)) then obs_seq=(findgen(orbi)+1) if obs_typ_num(orbind(0)) eq 2 then begin if indnum le 8 then begin obs_seq=fltarr(indnum) & goto,skip4 & endif if (max(shlong(0:orbi-1)) gt 2) then obs_seq=fltarr(indnum) if (target_altitude(1,orbind(orbi-1)) gt target_altitude(1,orbind(indnum/2))) and $ (target_altitude(1,orbind(0)) gt target_altitude(1,orbind(indnum/2))) then obs_seq=fltarr(indnum) skip4: endif endelse obs_sequence_index(orbind)=obs_seq ; if j gt 496 and min(obs_typ_num(orbind)) eq 2 then begin ; for u=0,n_elements(orbind)-1 do print,obs_typ_num(orbind(u)),obs_seq((u)),target_altitude(1,orbind(u)),target_local_time(orbind(u)),yd_obs(orbind(u)),sh(u),target_longitude(orbind(u)),shlong(u) ; stop ; endif endif endfor ;kk2=where(obs_sequence_index eq 0.) ;for u=0,n_elements(kk2)-1 do print,obs_typ_num(kk2(u)),obs_sequence_index(kk2(u)),target_altitude(1,kk2(u)),target_local_time(kk2(u)),yd_obs(kk2(u)),target_longitude(kk2(u)),orbit_number(kk2(u)) ;stop ;Filter out limb opportunities that are not limb drifts. ;in the above code I set obs_seq to zero if it is a ;observation I want to filter out. Now I can cleanly get rid of the ;limb observations that are not limb drift by filter on ;obs_sequence_index ne 0.0 ;Added additional filtering on snr and total_radiance. These points are typically bad and outside of 3 sigma error. index=where(obs_sequence_index ne 0. and total_radiance_snr gt -3 and total_radiance_kr gt -2) cdr_name=cdr_name(index) planet_sun_vector_tg=planet_sun_vector_tg(*,index) planet_sc_vector_tg=planet_sc_vector_tg(*,index) boresight_unit_vector_center_tg=boresight_unit_vector_center_tg(*,index) target_latitude=target_latitude(index) target_longitude=target_longitude(index) target_altitude=target_altitude(*,index) target_local_time=target_local_time(index) subspacecraft_latitude=subspacecraft_latitude(index) subspacecraft_longitude=subspacecraft_longitude(index) spacecraft_local_time=spacecraft_local_time(index) subsolar_latitude=subsolar_latitude(index) subsolar_longitude=subsolar_longitude(index) planet_true_anomaly=planet_true_anomaly(index) orbit_number=orbit_number(index) mid_spectrum_time=mid_spectrum_time(index) utc_time=utc_time(*,index) wavelength=wavelength(*,index) radiance_kr=radiance_kr(*,index) radiance_snr=radiance_snr(*,index) total_radiance_kr=total_radiance_kr(index) total_radiance_snr=total_radiance_snr(index) slit_pos=slit_pos(index) observation_type= observation_type(index) obs_sequence_index= obs_sequence_index(index) spacecraft_altitude=spacecraft_altitude(index) obs_typ_num=obs_typ_num(index) ;Need to delete bad data for Mg afternoon low altitude data if keyword_set(MG) then begin tt=where(target_altitude(1,*) le 400 and target_local_time ge 5 and target_local_time le 19,complement=index2) ;radiance_kr(*,tt)=-999 ;radiance_snr(*,tt)=-999 ;total_radiance_kr(tt)=-999 ;total_radiance_snr(tt)=-999 cdr_name=cdr_name(index2) planet_sun_vector_tg=planet_sun_vector_tg(*,index2) planet_sc_vector_tg=planet_sc_vector_tg(*,index2) boresight_unit_vector_center_tg=boresight_unit_vector_center_tg(*,index2) target_latitude=target_latitude(index2) target_longitude=target_longitude(index2) target_altitude=target_altitude(*,index2) target_local_time=target_local_time(index2) subspacecraft_latitude=subspacecraft_latitude(index2) subspacecraft_longitude=subspacecraft_longitude(index2) spacecraft_local_time=spacecraft_local_time(index2) subsolar_latitude=subsolar_latitude(index2) subsolar_longitude=subsolar_longitude(index2) planet_true_anomaly=planet_true_anomaly(index2) orbit_number=orbit_number(index2) mid_spectrum_time=mid_spectrum_time(index2) utc_time=utc_time(*,index2) wavelength=wavelength(*,index2) radiance_kr=radiance_kr(*,index2) radiance_snr=radiance_snr(*,index2) total_radiance_kr=total_radiance_kr(index2) total_radiance_snr=total_radiance_snr(index2) slit_pos=slit_pos(index2) observation_type= observation_type(index2) obs_sequence_index= obs_sequence_index(index2) spacecraft_altitude=spacecraft_altitude(index2) obs_typ_num=obs_typ_num(index2) endif if keyword_Set(NA) then filename='UD_0'+strcompress(i+1,/re)+'_LD_NA.sav' if keyword_Set(CA) then filename='UD_0'+strcompress(i+1,/re)+'_LD_CA.sav' if keyword_Set(MG) then filename='UD_0'+strcompress(i+1,/re)+'_LD_MG.sav' if i ge 9 then begin if keyword_Set(NA) then filename='UD_'+strcompress(i+1,/re)+'_LD_NA.sav' if keyword_Set(CA) then filename='UD_'+strcompress(i+1,/re)+'_LD_CA.sav' if keyword_Set(MG) then filename='UD_'+strcompress(i+1,/re)+'_LD_MG.sav' endif save,observation_type,cdr_name,obs_sequence_index,planet_sun_vector_tg,planet_sc_vector_tg, boresight_unit_vector_center_tg,target_latitude,$ target_longitude,target_altitude,target_local_time,subspacecraft_latitude,subspacecraft_longitude,spacecraft_altitude,spacecraft_local_time,$ subsolar_latitude,subsolar_longitude,planet_true_anomaly,orbit_number,mid_spectrum_time,utc_time,wavelength,radiance_kr,radiance_snr,$ total_radiance_kr,total_radiance_snr,slit_pos,filename=filename skip: endfor return end ;----------------------------------------------------------------------------- ; * process_night_sweeps_final - concatenates the calibrated data to create ; the UVVS night sweep DDR for a given species in a given Mercury Year. ;----------------------------------------------------------------------------- PRO process_night_sweeps_final,midtime_tt, planet_sun_vector_tt, planet_SC_vector_tt, boresight_unit_vector_center_tt, boresight_unit_vector_c1_tt, boresight_unit_vector_c2_tt, target_latitude_set_tt,$ target_longitude_set_tt, target_altitude_set_tt, subspacecraft_latitude_tt, subspacecraft_longitude_tt, subsolar_latitude_tt, subsolar_longitude_tt, true_anomaly_tt, step_utc_time_tt, macro_num_tt,$ filename_tt, scan_num_tt, obs_typ_num_tt, obs_typ_tt, obs_seq_index_tt, slit_tt, jd_obs_tt, yd_obs_tt, ymd_obs_tt, rad_kr_tt, rad_unc_tt, wavelength_tt, tot_rad_kr_tt, $ tot_rad_snr_tt,obs_solar_localtime_tt,orb_num_tt,spacecraft_altitude_tt,spacecraft_solar_localtime_tt,NA=NA, MG=MG, CA=CA,yearind ;Updated 11/2014 to include XM2 data ----AWM ;Updated 11/2015 to include XM3/XM4 data ----AWM Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2554,2773,3037,3300,3562,3819,4073] ;Start orbits for Mercury year boundaries Myear_orb_end=[171,348,527,707,925,1189,1453,1717,1980,2244,2317,2772,3036,3299,3561,3818,4072,4110] ;End orbits for Mercury year boundaries ;1804 needs to be extended with XM2 is added ;Loop over mercury years if yearind eq 0 then start_ind=0 if yearind eq 1 then start_ind=4 if yearind eq 2 then start_ind=8 if yearind eq 3 then start_ind=12 if yearind eq 4 then start_ind=16 for i=start_ind,17 do begin obs_typ_i=where(obs_typ_num_tt eq 5 and orb_num_tt ge Myear_orb_start(i) and orb_num_tt le Myear_orb_end(i) and (obs_solar_localtime_tt lt 6 or obs_solar_localtime_tt gt 19)) ; mercury year boundary orbit numbers based on TA ;UVVSEXOSCAN is assigned number 5 in open_mac##_NA_DDR.pro code. ;Filter for nightside measurements. ;stop if obs_typ_i(0) eq -1 then goto,skip o_index=n_elements(obs_typ_i) utc_time=fltarr(17,o_index) radiance_kr=fltarr(25,o_index) radiance_snr=fltarr(25,o_index) wavelength=fltarr(25,o_index) target_altitude=fltarr(3,o_index) target_altitude_set=target_altitude_set_tt(*,obs_typ_i) cdr_name=filename_tt(obs_typ_i) planet_sun_vector_tg=planet_sun_vector_tt(*,obs_typ_i) planet_sc_vector_tg=planet_sc_vector_tt(*,obs_typ_i) boresight_unit_vector_center_tg=boresight_unit_vector_center_tt(*,obs_typ_i) target_latitude=target_latitude_set_tt(0,obs_typ_i) target_longitude=target_longitude_set_tt(0,obs_typ_i) target_altitude(0,*)=target_altitude_set(0,*) for j=0,o_index-1 do begin target_altitude(1,j)=min(target_altitude_set(1:4,j)) target_altitude(2,j)=max(target_altitude_set(1:4,j)) endfor target_local_time=obs_solar_localtime_tt(obs_typ_i) subspacecraft_latitude=subspacecraft_latitude_tt(obs_typ_i) subspacecraft_longitude=subspacecraft_longitude_tt(obs_typ_i) spacecraft_local_time=spacecraft_solar_localtime_tt(obs_typ_i) subsolar_latitude=subsolar_latitude_tt(obs_typ_i) subsolar_longitude=subsolar_longitude_tt(obs_typ_i) planet_true_anomaly=true_anomaly_tt(obs_typ_i) orbit_number=orb_num_tt(obs_typ_i) mid_spectrum_time=midtime_tt(obs_typ_i) utc_time=byte(step_utc_time_tt(obs_typ_i)) total_radiance_kr=tot_rad_kr_tt(obs_typ_i) total_radiance_snr=tot_rad_snr_tt(obs_typ_i) slit_pos=slit_tt(obs_typ_i) observation_type= obs_typ_tt(obs_typ_i) obs_sequence_index= obs_seq_index_tt(obs_typ_i) spacecraft_altitude=spacecraft_altitude_tt(obs_typ_i) obs_typ_num=obs_typ_num_tt(obs_typ_i) if keyword_Set(NA) then begin wavelength(2:22,*)=wavelength_tt(*,obs_typ_i) radiance_kr(2:22,*)=rad_kr_tt(*,obs_typ_i) radiance_snr(2:22,*)=rad_unc_tt(*,obs_typ_i) endif if keyword_Set(MG) or keyword_set(CA) then begin wavelength(4:20,*)=wavelength_tt(*,obs_typ_i) radiance_kr(4:20,*)=rad_kr_tt(*,obs_typ_i) radiance_snr(4:20,*)=rad_unc_tt(*,obs_typ_i) endif ;for j=Myear_orb_start(i),Myear_orb_end(i) do begin ; orbind=where(orbit_number eq j) ; if orbind(0) ne -1 then begin ;for u=0,n_elements(orbind)-1 do print,obs_typ_num(orbind(u)),obs_sequence_index(orbind(u)),target_altitude(1,orbind(u)),target_local_time(orbind(u)),target_longitude(orbind(u)) ; if j gt 100 then stop ;endif ;endfor ;kk2=where(obs_sequence_index eq 0.) ;for u=0,n_elements(kk2)-1 do print,obs_typ_num(kk2(u)),obs_sequence_index(kk2(u)),target_altitude(1,kk2(u)),target_local_time(kk2(u)),target_longitude(kk2(u)),orbit_number(kk2(u)) ;Filter out scans that intersect the surface ;Use minimum altitude ;Added additional filtering on snr and total_radiance. These points are typically bad and outside of 3 sigma error. index=where(target_altitude(1,*) gt 0. and total_radiance_snr gt -3 and total_radiance_kr gt -2) cdr_name=cdr_name(index) planet_sun_vector_tg=planet_sun_vector_tg(*,index) planet_sc_vector_tg=planet_sc_vector_tg(*,index) boresight_unit_vector_center_tg=boresight_unit_vector_center_tg(*,index) target_latitude=target_latitude(index) target_longitude=target_longitude(index) target_altitude=target_altitude(*,index) target_local_time=target_local_time(index) subspacecraft_latitude=subspacecraft_latitude(index) subspacecraft_longitude=subspacecraft_longitude(index) spacecraft_local_time=spacecraft_local_time(index) subsolar_latitude=subsolar_latitude(index) subsolar_longitude=subsolar_longitude(index) planet_true_anomaly=planet_true_anomaly(index) orbit_number=orbit_number(index) mid_spectrum_time=mid_spectrum_time(index) utc_time=utc_time(*,index) wavelength=wavelength(*,index) radiance_kr=radiance_kr(*,index) radiance_snr=radiance_snr(*,index) total_radiance_kr=total_radiance_kr(index) total_radiance_snr=total_radiance_snr(index) slit_pos=slit_pos(index) observation_type= observation_type(index) obs_sequence_index= obs_sequence_index(index) spacecraft_altitude=spacecraft_altitude(index) ;Need to delete bad data for Mg afternoon low altitude data if keyword_set(MG) then begin tt=where(target_altitude(1,*) le 400 and target_local_time ge 5 and target_local_time le 19,complement=index2) ;radiance_kr(*,tt)=-999 ;radiance_snr(*,tt)=-999 ;total_radiance_kr(tt)=-999 ;total_radiance_snr(tt)=-999 cdr_name=cdr_name(index2) planet_sun_vector_tg=planet_sun_vector_tg(*,index2) planet_sc_vector_tg=planet_sc_vector_tg(*,index2) boresight_unit_vector_center_tg=boresight_unit_vector_center_tg(*,index2) target_latitude=target_latitude(index2) target_longitude=target_longitude(index2) target_altitude=target_altitude(*,index2) target_local_time=target_local_time(index2) subspacecraft_latitude=subspacecraft_latitude(index2) subspacecraft_longitude=subspacecraft_longitude(index2) spacecraft_local_time=spacecraft_local_time(index2) subsolar_latitude=subsolar_latitude(index2) subsolar_longitude=subsolar_longitude(index2) planet_true_anomaly=planet_true_anomaly(index2) orbit_number=orbit_number(index2) mid_spectrum_time=mid_spectrum_time(index2) utc_time=utc_time(*,index2) wavelength=wavelength(*,index2) radiance_kr=radiance_kr(*,index2) radiance_snr=radiance_snr(*,index2) total_radiance_kr=total_radiance_kr(index2) total_radiance_snr=total_radiance_snr(index2) slit_pos=slit_pos(index2) observation_type= observation_type(index2) obs_sequence_index= obs_sequence_index(index2) spacecraft_altitude=spacecraft_altitude(index2) obs_typ_num=obs_typ_num(index2) endif if keyword_Set(NA) then filename='UD_0'+strcompress(i+1,/re)+'_NS_NA.sav' if keyword_Set(CA) then filename='UD_0'+strcompress(i+1,/re)+'_NS_CA.sav' if keyword_Set(MG) then filename='UD_0'+strcompress(i+1,/re)+'_NS_MG.sav' if i ge 9 then begin if keyword_Set(NA) then filename='UD_'+strcompress(i+1,/re)+'_NS_NA.sav' if keyword_Set(CA) then filename='UD_'+strcompress(i+1,/re)+'_NS_CA.sav' if keyword_Set(MG) then filename='UD_'+strcompress(i+1,/re)+'_NS_MG.sav' endif save,observation_type,cdr_name,obs_sequence_index,planet_sun_vector_tg,planet_sc_vector_tg, boresight_unit_vector_center_tg,target_latitude,$ target_longitude,target_altitude,target_local_time,subspacecraft_latitude,subspacecraft_longitude,spacecraft_altitude,spacecraft_local_time,$ subsolar_latitude,subsolar_longitude,planet_true_anomaly,orbit_number,mid_spectrum_time,utc_time,wavelength,radiance_kr,radiance_snr,$ total_radiance_kr,total_radiance_snr,slit_pos,filename=filename skip: endfor return end