MESSENGER MASCS UVVS CDR TO ATMOSPHERE DDR PROCEDURES Version 5, 3/21/2017 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) Version 5, 3/21/2017, C. Mauceri, ACT Revised and added calibration procedures. * concat_na_ddr_final (revised) * 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) * open_mac85_na_ddr (revised) * open_mac87_na_ddr (revised) * open_mac91_na_ddr (revised) * open_mac92_na_ddr (revised) * process_dayside_limb_final (revised) * process_limb_drifts_final (revised) * process_night_sweeps_final (revised) * process_perorbit_summaryfile (added) * wavelength_scale (added) * concat_ca_ddr_final (added) * concat_mg_ddr_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. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * process_perorbit_summaryfile - concatenates the calibrated data to ; create a file per orbit per given species. The per orbit summary file ; contains all the observations for that species. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * wavelength_scale - wavelength scale procedure. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * concat_ca_ddr_final - compiles all the calcium data for the whole ; mission phase. There are 9 macro types (40,65,66,67,68,85,89,91,92) ; that can be used in operations to measure calcium. This program calls a ; program that searches the cdr database by date for each macro. The ; program reorganizes the calcium geometry and spectral information from ; the cdrs into a summary file as described in the UVVS SIS document. ; The total intensity and signal-to-noise over the calcium band is ; calculated and included in the DDRs. The data are written out to an ; IDL save file as an interim data product. ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; * concat_mg_ddr_final - compiles all the magnesium data for the whole ; mission phase. There are 9 macro types (35,65,66,67,68,87,89,91,92,99) ; that can be used in operations to measure magnesium. This program calls ; a program that searches the cdr database by date for each macro. The ; program reorganizes the magnesium geometry and spectral information ; from the cdrs into a summary file as described in the UVVS 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. ;----------------------------------------------------------------------------- ;***************************************************************************** ; 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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 uu=where(strmatch(obs_typ,'UVVSEPSPoleRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=15 uu=where(strmatch(obs_typ,'UVVSExoTargetObs*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=16 uu=where(strmatch(obs_typ,'UVVSFIPSZStareRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=17 uu=where(strmatch(obs_typ,'UVVSFIPSPAOptRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=18 uu=where(strmatch(obs_typ,'UVVSPAARideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=19 uu=where(strmatch(obs_typ,'UVVSSatSearchRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=20 uu=where(strmatch(obs_typ,'UVVSVulcanoidRideAlong*',/Fold_Case) eq 1) if uu(0) ne -1 then Obs_typ_num(uu)=21 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=['MASCS20120330','MASCS20120331','MASCS20120401','MASCS20120402','MASCS20120403','MASCS20120404','MASCS20120405'] date2=[date2,'MASCS20120406','MASCS20120407','MASCS20120408','MASCS20120409','MASCS20210410','MASCS20210411','MASCS20210412','MASCS20120413'] date2=[date2,'MASCS20120414','MASCS20120415','MASCS20120416','MASCS20120417','MASCS20210418','MASCS20210419','MASCS20210420','MASCS20120421'] date2=[date2,'MASCS20120422','MASCS20120423','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'] ;['MASCS20120920','MASCS20120921','MASCS20120922','MASCS20120923''] date2=[date2,'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'] date33=['MASCS20130906'] 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'] date3=[date3,'MASCS20130909','MASCS20130910','MASCS20130911','MASCS20130912','MASCS20130913','MASCS20130914','MASCS20130915','MASCS20130916'] date3=[date3,'MASCS20130917','MASCS20130918','MASCS20130919','MASCS20130920','MASCS20130921','MASCS20130922','MASCS20130923','MASCS20130924'] date3=[date3,'MASCS20130925','MASCS20130926','MASCS20130927','MASCS20130928','MASCS20130929','MASCS20130930','MASCS20131001','MASCS20131002'] date3=[date3,'MASCS20131003','MASCS20131004','MASCS20131005','MASCS20131006','MASCS20131007','MASCS20131008','MASCS20131009','MASCS20131010'] date3=[date3,'MASCS20131011','MASCS20131012','MASCS20131013','MASCS20131014','MASCS20131015','MASCS20131016','MASCS20131017','MASCS20131018'] date3=[date3,'MASCS20131019','MASCS20131020','MASCS20131021','MASCS20131022','MASCS20131023','MASCS20131024','MASCS20131025','MASCS20131026'] date3=[date3,'MASCS20131027','MASCS20131028','MASCS20131029','MASCS20131030','MASCS20131031','MASCS20131101','MASCS20131102','MASCS20131103'] date3=[date3,'MASCS20131104','MASCS20131105','MASCS20131106','MASCS20131107','MASCS20131108','MASCS20131109','MASCS20131110','MASCS20131111'] date3=[date3,'MASCS20131112','MASCS20131113','MASCS20131114','MASCS20131115','MASCS20131116','MASCS20131117','MASCS20131118','MASCS20131119'] date3=[date3,'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','MASCS20150122'] date5=['MASCS20150120','MASCS20150121','MASCS20150122'] 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','MASCS20150325' date5=[date5,'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_new2/' merkelpath1 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm_new2/' merkelpath2 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm2_new2/' merkelpath3 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm3_new2/' merkelpath4 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm4_new2/' 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 if j eq 0 then begin diff=orig(1,*)-orig(17,*) yy=where(total(orig(0:1,*),1) ne 0.00) yy2=where(total(orig(19:20,yy),1) ne 0.00) yy3=where(diff(yy(yy2)) lt 2e4 and diff(yy(yy2)) gt -1.2e4) ;to deal with large slant scans yy4=where(na_tot_rad_kr(yy(yy2(yy3))) ge -5) yy5=where(na_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -4) index2=yy(yy2(yy3(yy4(yy5)))) endif if j eq 1 then begin diff=orig(1,*)-orig(15,*) yy=where(total(orig(*,*),1) ne 0.00) yy2=where(total(orig(15:16,yy),1) ne 0.00) ;Filter out saturated scans yy3=where(diff(yy(yy2)) lt 2e4 and (diff(yy(yy2)) gt -2e4 and orig(0,yy(yy2)) ne 0.)) ;to deal with large slant scans yy4=where(na_tot_rad_kr(yy(yy2(yy3))) ge -5 and orig(19,yy(yy2(yy3))) ne 0.) yy5=where(na_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -3) index2=yy(yy2(yy3(yy4(yy5)))) endif if j eq 2 then begin diff=orig(1,*)-orig(15,*) yy=where(total(orig(*,*),1) ne 0.00) yy2=where(total(orig(15:16,yy),1) ne 0.00) ;Filter out saturated scans yy3=where(diff(yy(yy2)) lt 2e4 and (diff(yy(yy2)) gt -2e4 and orig(0,yy(yy2)) ne 0.)) ;to deal with large slant scans cc=where(na_tot_rad_kr(yy(yy2(yy3))) lt -5 and orig(19,yy(yy2(yy3))) ne 0. and na_tot_rad_snr(yy(yy2(yy3))) lt -2, complement=yy4) cc=where(na_tot_rad_kr(yy(yy2(yy3(yy4)))) gt -5 and orig(19,yy(yy2(yy3(yy4)))) ne 0. and na_tot_rad_snr(yy(yy2(yy3(yy4)))) lt -2,complement=yy5) yy6=where(na_tot_rad_kr(yy(yy2(yy3(yy4(yy5))))) gt -100) index2=yy(yy2(yy3(yy4(yy5(yy6))))) endif if j eq 3 then begin diff=orig(1,*)-orig(15,*) yy=where(total(orig(*,*),1) ne 0.00) yy2=where(total(orig(15:16,yy),1) ne 0.00) ;Filter out saturated scans yy3=where(diff(yy(yy2)) lt 1e4 and (diff(yy(yy2)) gt -2e4 and orig(0,yy(yy2)) ne 0.)) ;to deal with large slant scans yy4=where(na_tot_rad_kr(yy(yy2(yy3))) gt -20) yy5=where(na_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -3) index2=yy(yy2(yy3(yy4(yy5)))) endif if j eq 4 then begin diff=orig(1,*)-orig(15,*) yy=where(total(orig(*,*),1) ne 0.00) yy2=where(total(orig(15:16,yy),1) ne 0.00) ;Filter out saturated scans yy3=where(diff(yy(yy2)) lt 1e4 and (diff(yy(yy2)) gt -1e4 and orig(0,yy(yy2)) ne 0.)) ;to deal with large slant scans yy4=where(na_tot_rad_kr(yy(yy2(yy3))) gt -20) yy5=where(na_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -3) index2=yy(yy2(yy3(yy4(yy5)))) endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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 process_perorbit_summaryfile,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 Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2509,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,2508,2772,3036,3299,3561,3818,4072,4110] ;End orbits for Mercury year boundaries ;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 ; do not include uncorrected dayside limb scans for Mg ;Data not corrected is before orbit 820 and after orbit 3976 (Nominal mission and low alititude portion of mission at the very end). if keyword_set(MG) then $ 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) and orb_num_tt ge 820. and orb_num_tt le 3976. and slit_tt eq 1) ; if keyword_set(CA) or keyword_set(NA) then 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) index=where(target_altitude(1,*) gt 0. ) 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) ;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 outdir = 'output' file_mkdir,outdir filename = outdir+'/'+filename 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: ;stop 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 Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2509,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,2508,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 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) index=where(obs_sequence_index ne 0. ) 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) tt=where( 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 outdir = 'output' file_mkdir,outdir filename = outdir+'/'+filename 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 Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2509,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,2508,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) ;adiance_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_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 outdir = 'output' file_mkdir,outdir filename = outdir+'/'+filename 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_perorbit_summaryfile - concatenates the calibrated data to ; create a file per orbit per given species. The per orbit summary file ; contains all the observations for that species. ;----------------------------------------------------------------------------- PRO process_perorbit_summaryfile,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 start_orb=21 end_orb=4110 ;Mercury year definition by orbit number ; 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 Myear_orb_start=[21,172,349,528,708,926,1190,1454,1718,1981,2245,2509,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,2508,2772,3036,3299,3561,3818,4072,4110] ;End orbits for Mercury year boundaries ;Loop over orbits for i=start_orb,end_orb do begin myear = where(myear_orb_end ge i and myear_orb_start le i) + 1 myear = myear[0];otherwise myear is an array with one element orb_i=where(orb_num_tt eq i) ;;Find index for orbit number if orb_i(0) eq -1 then goto,skip ;;If none found then skip and not save a file. o_index=n_elements(orb_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(*,orb_i) cdr_name=filename_tt(orb_i) planet_sun_vector_tg=planet_sun_vector_tt(*,orb_i) planet_sc_vector_tg=planet_sc_vector_tt(*,orb_i) boresight_unit_vector_center_tg=boresight_unit_vector_center_tt(*,orb_i) target_latitude=target_latitude_set_tt(0,orb_i) target_longitude=target_longitude_set_tt(0,orb_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(orb_i) subspacecraft_latitude=subspacecraft_latitude_tt(orb_i) subspacecraft_longitude=subspacecraft_longitude_tt(orb_i) spacecraft_local_time=spacecraft_solar_localtime_tt(orb_i) subsolar_latitude=subsolar_latitude_tt(orb_i) subsolar_longitude=subsolar_longitude_tt(orb_i) planet_true_anomaly=true_anomaly_tt(orb_i) orbit_number=orb_num_tt(orb_i) mid_spectrum_time=midtime_tt(orb_i) utc_time=byte(step_utc_time_tt(orb_i)) total_radiance_kr=tot_rad_kr_tt(orb_i) total_radiance_snr=tot_rad_snr_tt(orb_i) slit_pos=slit_tt(orb_i) observation_type= obs_typ_tt(orb_i) obs_sequence_index= obs_seq_index_tt(orb_i) spacecraft_altitude=spacecraft_altitude_tt(orb_i) obs_typ_num=obs_typ_num_tt(orb_i) yd_orb=yd_obs_tt(orb_i) if keyword_Set(NA) then begin wavelength(2:22,*)=wavelength_tt(*,orb_i) radiance_kr(2:22,*)=rad_kr_tt(*,orb_i) radiance_snr(2:22,*)=rad_unc_tt(*,orb_i) endif if keyword_Set(MG) or keyword_set(CA) then begin wavelength(4:20,*)=wavelength_tt(*,orb_i) radiance_kr(4:20,*)=rad_kr_tt(*,orb_i) radiance_snr(4:20,*)=rad_unc_tt(*,orb_i) endif ;Remove spaces trailing the string variable to be used in the next where statement ;nel=n_elements(orb_i) ;for s=0,nel-1 do begin ; observation_type(s)=strtrim(observation_type(s),2) ;endfor ;Filter on observation type ;May add more filtering later on SNR and total radiance values Oct. 2016 ;Remove spaces trailing the string variable to be used in the next where statement obs_type=observation_type nel=n_elements(orb_i) for s=0,nel-1 do begin obs_type(s)=strtrim(observation_type(s),2) endfor index=where( obs_type ne 'UVVSOther' and obs_type ne 'UVVSStarcal' and obs_type ne 'UVVSSurfaceTarget' $ and obs_type ne 'UVVSGridPoint' and obs_type ne 'UVVSPhotometry' ) 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) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; do not include uncorrected dayside data for Mg including LimbOpp ;Need to filter out dayside data that isn't a limb scan. ;Limbscan Data not corrected before orbit 820 and after orbit 3976 (Nominal mission and low alititude portion of mission at the very end). if keyword_set(MG) then begin ;;;Check this;;;; tt=where((orbit_number lt 820 or orbit_number gt 3976) and target_local_time ge 5. and target_local_time le 19,complement=ind2) if ind2(0) eq -1 then goto,skip ind3=where(((obs_typ_num(ind2) eq 1 or obs_typ_num(ind2) eq 14) and target_local_time(ind2) gt 5.0 and target_local_time(ind2) lt 18.8 and target_altitude(1,ind2) ne 0.) or $ (target_local_time(ind2) lt 6 or target_local_time(ind2) gt 18.) and slit_pos(ind2) eq 1) tt2=where((obs_typ_num(ind2(ind3)) eq 2 or obs_typ_num(ind2(ind3)) eq 4 or obs_typ_num(ind2(ind3)) eq 6) and target_local_time(ind2(ind3)) gt 5.0 and target_local_time(ind2(ind3)) lt 18.8,complement=ind4) index2=ind2(ind3(ind4)) if index2(0) eq -1 then goto,skip 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 ;find the index of the midpint in the orbit ;probably do it by UTC start time and add 4 or 6 hours. yd_mid=yd_orb(n_elements(index)/2) ;Filename = UD_ORB####_YYDDD_SUMMARY_NA.sav filename = 'UD_' filename += string(myear,format='(I02)') filename += '_ORB'+string(i,format='(I04)') year = strmid(strcompress(string(yd_mid),/re),2,2) filename += '_'+year day = strmid(strcompress(string(yd_mid),/re),4,3) filename += day if keyword_Set(NA) then filename+='_SUMMARY_NA.sav' if keyword_Set(CA) then filename+='_SUMMARY_CA.sav' if keyword_Set(MG) then filename+='_SUMMARY_MG.sav' outdir = 'output_summary' file_mkdir,outdir filename = outdir+'/'+filename save,observation_type,cdr_name,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 ;----------------------------------------------------------------------------- ; * wavelength_scale - wavelength scale procedure. ;----------------------------------------------------------------------------- ;+ ; Purpose: ; This routine provides the UVVS wavelength, bandpass, and step size at each grating position. ; ; Inputs: ; DETECTOR: A string indicating which detector channel: 'FUV', 'MUV', 'VIS' ; ; Outputs: ; WL: Wavelength in angstroms. ; INDEX: This output variable is not defined!! ; BP: Bandpass at corresponding wavelength, units of angstroms. This is the apparent spectral width of a monochromatic source ; filling the aperture stop and slit width. ; STEP_SIZE: Wavelength increment for one grating step at the corresponding wavelength, in units of angstroms. ; RAT: Ratio of the entrance slit image to exit slit width. ;- PRO WAVELENGTH_SCALE,WL,INDEX,DETECTOR,BP,STEP_SIZE,RAT ; ; NOTE: The following represents old, historical documentation. This routine has been modified ; and adapted over time, so not all of this material is relevant to the current version. ; ; MASCS WAVELENGTH SCALE PROCEDURE ; NTUBE IS THE TUBE NUMBER 1=FUV,2=MUV,3=VIS ; IF N GT 0 A 528 POINT WAVELENGTH SCALE ; WILL BE RETURNED FOR THE SPECIFIED TUBE ; IF N LT 0 A SET OF INDICIES IS RETURNED ; CORRESPONDING TO POINTS ON AN INPUT WAVELENGTH ; SCALE OF ARBITRARY CONSTRUCTION ; RAT IS THE RATIO OF ENTRANCE SLIT IMAGE TO EXIT SLIT WIDTH ; TOP IS THE TOP OF THE TRAPEZODDAL LINE SHAPE IN WAVELENGTH UNITS ; BOTTOM IS THE BOTTOM OF THE LINESHAPE IN WAVELENGTH UNITS ; SLOPE IS THE SLOPE OF THE SIDE OF THE TRAPEZOID ; UPDATED FOR N AND F 12/15/87 ; UPDATED FOR 5.1 SOFTWARE 6/26/89 ; UPDATED AGAIN 8/30/96 FOR ERROR IN BP ; UPDATED AGAIN 5/7/04 FOR MASCS (TODD BRADLEY) ; SPACE=2400E-7; SPACING OF GRATING GROOVES RAD=57.29578; step=0.016664671/rad ; GRATING STEP SIZE. This value obtained by using curvefit from IDL 5/7/04 A0=-2.0203037/rad; This value obtained by using curvefit from IDL 5/7/04 IF DETECTOR EQ 'VIS' THEN BEGIN C1=9.9976330/rad; This value obtained by using curvefit from IDL 5/7/04 N=1. END ;FUV CHANNEL IF DETECTOR EQ 'FUV' THEN BEGIN C1=14.672540/RAD ;This value obtained 5/7/04 N=2. END IF DETECTOR EQ 'MUV' THEN BEGIN C1=12.331906/RAD ; This value obtained by using curvefit from IDL 5/7/04 N=1. END WL=2*SIN(A0+FINDGEN(2501)*STEP+C1)*COS(C1)/SPACE/N ; N is the grating order ;BANDPASS STEP_SIZE=2*COS(A0+FINDGEN(2501)*STEP-STEP/2+C1)*COS(C1)*STEP/N/SPACE w_ex=0.23 w_en=0.1725 theta=a0+findgen(2501)*step+c1 alp=(theta-c1) bet=(theta+c1) CB=COS(bet)*w_ex CA=COS(alp)*w_en RAT=CA/CB bp=fltarr(n_elements(wl)) i1=where(rat ge 1) i2=where(rat lt 1) BP(i1)=(CA(i1))/SPACE/N/125. BP(i2)=(CB(i2))/SPACE/N/125. RETURN END ;----------------------------------------------------------------------------- ; * concat_ca_ddr_final - compiles all the calcium data for the whole ; mission phase. There are 9 macro types (40,65,66,67,68,85,89,91,92) ; that can be used in operations to measure calcium. This program calls a ; program that searches the cdr database by date for each macro. The ; program reorganizes the calcium geometry and spectral information from ; the cdrs into a summary file as described in the UVVS SIS document. ; The total intensity and signal-to-noise over the calcium 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_ca_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=['MASCS20120330','MASCS20120331','MASCS20120401','MASCS20120402','MASCS20120403','MASCS20120404','MASCS20120405'] date2=[date2,'MASCS20120406','MASCS20120407','MASCS20120408','MASCS20120409','MASCS20210410','MASCS20210411','MASCS20210412','MASCS20120413'] date2=[date2,'MASCS20120414','MASCS20120415','MASCS20120416','MASCS20120417','MASCS20210418','MASCS20210419','MASCS20210420','MASCS20120421'] date2=[date2,'MASCS20120422','MASCS20120423','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'] ;['MASCS20120920','MASCS20120921','MASCS20120922','MASCS20120923''] date2=[date2,'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'] ;date33=['MASCS20130908'] ;date33=['MASCS20130903'] 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'] date3=[date3,'MASCS20130909','MASCS20130910','MASCS20130911','MASCS20130912','MASCS20130913','MASCS20130914','MASCS20130915','MASCS20130916'] date3=[date3,'MASCS20130917','MASCS20130918','MASCS20130919','MASCS20130920','MASCS20130921','MASCS20130922','MASCS20130923','MASCS20130924'] date3=[date3,'MASCS20130925','MASCS20130926','MASCS20130927','MASCS20130928','MASCS20130929','MASCS20130930','MASCS20131001','MASCS20131002'] date3=[date3,'MASCS20131003','MASCS20131004','MASCS20131005','MASCS20131006','MASCS20131007','MASCS20131008','MASCS20131009','MASCS20131010'] date3=[date3,'MASCS20131011','MASCS20131012','MASCS20131013','MASCS20131014','MASCS20131015','MASCS20131016','MASCS20131017','MASCS20131018'] date3=[date3,'MASCS20131019','MASCS20131020','MASCS20131021','MASCS20131022','MASCS20131023','MASCS20131024','MASCS20131025','MASCS20131026'] date3=[date3,'MASCS20131027','MASCS20131028','MASCS20131029','MASCS20131030','MASCS20131031','MASCS20131101','MASCS20131102','MASCS20131103'] date3=[date3,'MASCS20131104','MASCS20131105','MASCS20131106','MASCS20131107','MASCS20131108','MASCS20131109','MASCS20131110','MASCS20131111'] date3=[date3,'MASCS20131112','MASCS20131113','MASCS20131114','MASCS20131115','MASCS20131116','MASCS20131117','MASCS20131118','MASCS20131119'] date3=[date3,'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','MASCS20150325' date5=[date5,'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 November 2012 ;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 ;Very large CME on Sept. 1 and 2,2014 (2014244 and 2014245) ;Very large CME on Dec. 14-16,2014 (2014348 - 2013350) ;Exclude March 24,2015 due to high background counts due to SEP merkelpath = '/Volumes/mascs_data/APL_Merkel/cdr_products_new2/' merkelpath1 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm_new2/' merkelpath2 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm2_new2/' merkelpath3 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm3_new2/' merkelpath4 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm4_new2/' 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/'+'*_{40,65,66,67,68,85,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path1+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path2+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path3+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path4+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*.sav') endif if location eq 1 then begin xx=file_search(path+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path2+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path3+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path4+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path5+date(dd)+'/UVVS/VIS/'+'*_{40,65,66,67,68,85,89,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, 'CALCIUM' ;changed to case statements: RCE 11/09/2012 macro_int = fix(macrotop) case macro_int of 40: begin open_mac40_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 65: begin open_mac65_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 66: begin open_mac66_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 67: begin open_mac67_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 68: begin open_mac68_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 85: begin open_mac85_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 89: begin open_mac89_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 91: begin open_mac91_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 end 92: begin open_mac92_ca_DDR,xx(i),location,ca_rad_kr6,ca_rad_unc6,wvl6,ca_tot_rad_kr6,ca_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,dark6 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]] dark=[[dark6]] ;sol_fit=[[sol_fit6]] jd_obs=[jd_obs6] yd_obs=[yd_obs6] ymd_obs=[[ymd_obs6]] ca_rad_kr=[[ca_rad_kr6]] ca_rad_unc=[[ca_rad_unc6]] wavelength=[[wvl6]] ca_tot_rad_kr=[ca_tot_rad_kr6] ca_tot_rad_unc=[ca_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] jd_obs=[jd_obs,jd_obs6] yd_obs=[yd_obs,yd_obs6] ymd_obs=[[ymd_obs],[ymd_obs6]] ca_rad_kr=[[ca_rad_kr],[ca_rad_kr6]] ca_rad_unc=[[ca_rad_unc],[ca_rad_unc6]] wavelength=[[wavelength],[wvl6]] ca_tot_rad_kr=[ca_tot_rad_kr,ca_tot_rad_kr6] ca_tot_rad_unc=[ca_tot_rad_unc,ca_tot_rad_unc6] orig=[[orig],[orig6]] dark=[[dark],[dark6]] ;sol_fit=[[sol_fit],[sol_fit6]] 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) dark=dark(*,index) ;sol_fit=sol_fit(*,index) jd_obs=jd_obs(index) yd_obs=yd_obs(index) ymd_obs=ymd_obs(*,index) ca_rad_kr=ca_rad_kr(*,index) ca_rad_unc=ca_rad_unc(*,index) wavelength=wavelength(*,index) ca_tot_rad_kr=ca_tot_rad_kr(index) ca_tot_rad_snr=ca_tot_rad_unc(index) ;localtime 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) minalt=fltarr(n_elements(index)) for t=0,n_elements(index)-1 do minalt(t)=min(target_altitude_set(*,t)) ;;;;;remove spaces on observation_type so usable in searches obs_type=strarr(n_elements(obs_typ)) nel=n_elements(obs_typ) for s=0,nel-1 do begin obs_type(s)=strtrim(obs_typ(s),2) endfor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;START of Ca surface slit averaging macro_num=macro ;c=fltarr(17,num) obs_tt=['UVVSDaysideScan','UVVSLimbOpp','UVVSExoNadir'] ; observation types looking for orbind=n_elements(orb_num) orb1=min(orb_num) orb2=max(orb_num) for m=orb1,orb2 do begin for tt=0,2 do begin hh=where(orb_num eq m and obs_type eq obs_tt(tt) and slit eq 0 and obs_solar_localtime gt 0) if hh(0) ne -1 then begin ;;;;;Setup solar continuum for solar fit;;;;;;;;;;;;; restore,'kurucz_forwardmodel_wavelength_shift_21steps.sav' caind=findgen(17)+1028 kurnew=uvvs_kurucz indd=17 scaleca=[0.977011, 0.999824 ,1.00314, 0.993970, 0.994390, 1.00663, 0.994672, 0.972268 ,0.966 , 0.995, 1.00354, 0.999594, 1.00375, 0.988071, 0.991952, 0.998315, 0.996923] for i=0,20 do kurnew(caind(0:16),i)=uvvs_kurucz(caind(0:16),i) *scaleca ;wavelength_scale,test,ind,'VIS' ;range1=[test(1374),test(1390)]/10 ;wvl=uvvs_kuwl(solind_orig) sol=kurnew(caind,*) scale40=[0.99264079, 0.97802179, 0.98, 0.99459208, 0.99331613, 0.97444333, 0.97885127, 1.0159148] for i=0,20 do sol(11:16,i)=sol(11:16,i) *scale40(0:5) scale10=[ 1.0247436, 1.0036159, 0.99449500, 0.99942131, 1.0010177, 0.99806194, 1.0028395, 1., 1.00 ,1.00, 0.99959222, 0.99595479, 0.99665381, 1.0056171, 0.99494345, 0.98875680, 1.0088014] for i=0,20 do sol(*,i)=sol(*,i) *scale10 ;iind=[2,3,4,5,indd-7,indd-6,indd-5,indd-4,indd-3] iind=[2,3,4,5,6,indd-7,indd-6,indd-5,indd-4] ;;;;;;;;;;;;;; loc=obs_solar_localtime(hh) malt=minalt(hh) ;taa=true_anomaly(hh) origt=orig(*,hh) wave=wavelength(*,hh) darkt=dark(*,hh) orbi=n_elements(hh) date=strcompress(string(yd_obs(hh)),/remove_all) yyddd=(strmid(date,2,5)) ;Shifting zigzag scans so that wavelengths lineup for averaging. kk=where(macro_num(hh) eq 40) if kk(0) ne -1 then begin dd1=where(wave(0,kk) gt 421.3) dd2=where(wave(0,kk) lt 421.3) origt(2:16,kk(dd1))=origt(0:14,kk(dd1)) origt(2:16,kk(dd2))=origt(2:16,kk(dd2)) origt(0:1,kk)=fltarr(2,n_elements(kk)) wave(2:16,kk(dd1))=wave(0:14,kk(dd1)) wave(0,kk(dd1))=fltarr(n_elements(dd1))+421.14 wave(1,kk(dd1))=fltarr(n_elements(dd1))+421.345 wave(2:16,kk(dd2))=wave(2:16,kk(dd2)) endif ;;;Find limb scans by localtime shift ;;;;;;;; sh=abs(shift(loc,1)-loc) shif=where(sh gt .2) if macro_num(hh(0)) gt 50 and n_elements(shif) gt 2 then shif=where(sh gt 1) if macro_num(hh(0)) gt 50 and n_elements(shif) gt 2 then begin print,'macro not used, skipping' goto, skip2 endif if obs_type(hh(0)) eq 'UVVSLimbOpp' then shif=where(sh gt 2) for pp=0,n_elements(shif)-1 do begin if pp eq n_elements(shif)-1 and shif(0) eq -1 then timind=findgen(orbi) if pp eq n_elements(shif)-1 and shif(0) ne -1 then begin timind=findgen(orbi-shif(pp))+shif(pp) endif else begin if shif(0) ne -1 then timind=findgen(shif(pp+1)-shif(pp))+shif(pp) endelse if n_elements(timind) lt 3 then goto,skip2 nn=n_elements(timind) origavg=fltarr(17,nn-3) altavg=fltarr(nn-3) waveavg=fltarr(17,nn-3) darkavg=fltarr(17,nn-3) ss_temp=fltarr(17,21,nn-3) sol_dev=fltarr(17,21,nn-3) b_corr_all=fltarr(21,nn-3) sol_fit_temp=fltarr(17,nn-3) sol_dev_temp=fltarr(17,nn-3) ca_rad_temp=fltarr(17,nn-3) ca_snr_temp=fltarr(17,nn-3) ca_tot_rad_temp=fltarr(nn-3) ca_tot_snr_temp=fltarr(nn-3) uncert_temp=fltarr(17,nn-3) totalrate=fltarr(17,nn-3) d=fltarr(nn-2) tarlat=fltarr(5,nn-3) tarlon=fltarr(5,nn-3) taralt=fltarr(5,nn-3) spaclat=fltarr(nn-3) spaclon=fltarr(nn-3) subsollat=fltarr(nn-3) subsollon=fltarr(nn-3) midt=fltarr(nn-3) pl_sun_vec=fltarr(3,nn-3) pl_sc_vec=fltarr(3,nn-3) bor_cent=fltarr(3,nn-3) bor_c1=fltarr(3,nn-3) bor_c2=fltarr(3,nn-3) tanomaly=fltarr(nn-3) loct=fltarr(nn-3) ; utc=fltarr(nn-3) ;This sets data that is set to zero to NAN to make it easier to average. if macro(hh(timind(0))) eq 40 and total(origt(0:1,timind)) eq 0 then iind=[2,3,4,5,6,7,indd-8,indd-7,indd-6,indd-5] if macro(hh(timind(0))) eq 40 and total(origt(15:16,timind)) eq 0 then iind=[2,3,4,5,6,7,indd-7,indd-6,indd-5] qq=where(origt eq 0) origt(qq)=!values.F_NAN ;if macro_num(hh(0)) eq 40 then stop ;Average over 4 points along altitude on the dayside for ll=0,nn-4 do begin origavg(*,ll)=mean(origt(*,timind(ll:ll+3)),dimen=2,/nan) altavg(ll)=mean(malt(timind(ll:ll+3))) waveavg(*,ll)=mean(wave(*,timind(ll:ll+3)),dimen=2) darkavg(*,ll)=mean(darkt(*,timind(ll:ll+3)),dimen=2) totalrate(*,ll)=total(origt(*,timind(ll:ll+3)),2,/nan) spaclat(ll)=mean(subspacecraft_latitude(hh(timind(ll:ll+3)))) spaclon(ll)=mean(subspacecraft_longitude(hh(timind(ll:ll+3)))) subsollat(ll)=mean(subsolar_latitude(hh(timind(ll:ll+3)))) subsollon(ll)=mean(subsolar_longitude(hh(timind(ll:ll+3)))) tanomaly(ll)=mean(true_anomaly(hh(timind(ll:ll+3)))) midt(ll)=mean(midtime(hh(timind(ll:ll+3)))) loct(ll)=mean(obs_solar_localtime(hh(timind(ll:ll+3)))) for vv=0,4 do begin tarlat(vv,ll)=mean(target_latitude_set(vv,hh(timind(ll:ll+3))),dimen=2) tarlon(vv,ll)=mean(target_longitude_set(vv,hh(timind(ll:ll+3))),dimen=2) taralt(vv,ll)=mean(target_altitude_set(vv,hh(timind(ll:ll+3))),dimen=2) endfor for vv=0,2 do begin pl_sun_vec(vv,ll)=mean(planet_sun_vector_TG(vv,hh(timind(ll:ll+3))),dimen=2) pl_sc_vec(vv,ll)=mean(planet_SC_vector_TG(vv,hh(timind(ll:ll+3))),dimen=2) bor_cent(vv,ll)=mean(boresight_unit_vector_center_TG(vv,hh(timind(ll:ll+3))),dimen=2) bor_c1(vv,ll)=mean(boresight_unit_vector_c1_tg(vv,hh(timind(ll:ll+3))),dimen=2) bor_c2(vv,ll)=mean(boresight_unit_vector_c2_tg(vv,hh(timind(ll:ll+3))),dimen=2) endfor corre=fltarr(21) ;Finds where dark is set to zero and sets it to the dark value for the spectral scan ;Makes it easier to handle NAN and zeros when subtracting orig-dark qq=where(darkavg(*,ll) eq 0.,complement=cc) darkavg(qq,ll)=darkavg(cc(0),ll) c=origavg(*,ll)-darkavg(*,ll) ; qq=where(finite(c) eq 0) ; c(qq) = 0.0 if total(origavg(0:1,ll)) eq 0 then c(0:1)=fltarr(2) ;;;Fit solar continuum for jj=0,20 do begin x_data=waveavg[iind,ll] x_data_bar=mean(waveavg[iind,ll]) x=x_data-x_data_bar y_data=reform(c[iind])/sol[iind,jj] y_data_bar=mean(y_data,/nan) y=y_data-y_data_bar tt2=where(finite(y) eq 1) coeffs = linfit(x(tt2),y(tt2),sigma=sigma,/double) ss_temp[*,jj,ll] = sol(*,jj) * (coeffs[0] + coeffs[1] * (waveavg(*,ll)-x_data_bar) + y_data_bar) sol_dev(*,jj,ll)=sol(*,jj)*sqrt(sigma(0)*sigma(0)+sigma(1)*sigma(1)*(waveavg(*,ll)-x_data_bar)*(waveavg(*,ll)-x_data_bar)) ;Makes sure correlating using real numbers and non NAN's qq=where(finite(c(iind)) eq 1) ; c(qq) = 0.0 ;corre(jj)=correlate(c(2:*),ss_temp(2:*,jj,ll)) corre(jj)=correlate(c(iind(qq)),ss_temp(iind(qq),jj,ll)) ; corre(jj)=correlate(c(qq),ss_temp(qq,jj,ll)) ; if macro(hh(timind(0))) eq 40 and ll ge 133 then stop endfor d(ll)=max(abs(corre)) ind=!c sol_fit_temp(*,ll)=ss_temp(*,ind,ll) if total(origavg(0:1,ll)) eq 0 then sol_fit_temp(0:1,ll)=fltarr(2) sol_dev_temp(*,ll)=sol_dev(*,ind,ll) b_corr_all(*,ll)=(corre) dark_std_temp=10+sqrt(darkavg(*,ll)*4.) ;fully_corr_avg(*,ll)=origavg(*,ll)-darkavg(*,ll)-sol_fit_temp(*,ll) ; totsig=sqrt(totalrate(*,ll)*4.)/2. ; uncert_temp(*,ll)=sqrt(totsig*totsig+dark_std_temp*dark_std_temp+sol_dev_temp(*,ll)*sol_dev_temp(*,ll)) uncert_temp(*,ll)=sqrt(origavg(*,ll)*4+dark_std_temp*dark_std_temp+sol_dev_temp(*,ll)*sol_dev_temp(*,ll)) UVVS_sensitivity,'VIS',0,waveavg(*,ll),sensin0 uvvs_sensitivity_correction_dec2016,yyddd(ll),'VIS',waveavg(*,ll),sensin0,sens0 ca_rad_temp(*,ll)=(c(*)-sol_fit_temp(*,ll))/sens0 ca_snr_temp(*,ll)=abs(c(*)-sol_fit_temp(*,ll))/(uncert_temp(*,ll)) ca_wrange = (total(waveavg[7:10,0]) - total(waveavg[6:9,0])) / 4.0 if waveavg(0,ll) lt 421.4 then begin ca_tot_rad_temp(ll)=total(ca_rad_temp[6:10,ll],1) * ca_wrange ca_tot_snr_temp(ll)=total((c[6:10]-sol_fit_temp[6:10,ll]),1)/sqrt(total(uncert_temp[6:10,ll]^2,1)) endif else begin ca_tot_rad_temp(ll)=total(ca_rad_temp[4:8,ll],1) * ca_wrange ca_tot_snr_temp(ll)=total((c[4:8]-sol_fit_temp[4:8,ll]),1)/sqrt(total(uncert_temp[4:8,ll]^2,1)) endelse ;if macro_num(hh(0)) eq 40 then stop endfor qq2=where(finite(ca_rad_temp) eq 0) ;stop if qq2(0) ne -1 then begin ca_rad_temp(qq2)=0.0 ca_snr_temp(qq2)=0.0 endif ;Copy average back into arrays and put -9999. where needs reindexing in due to 3 less points in the limb scan ca_rad_kr(*,hh(timind(0:nn-4)))=ca_rad_temp ca_rad_kr(*,hh(timind(nn-3:nn-1)))=fltarr(17,3)+(-9999.) ca_rad_unc(*,hh(timind(0:nn-4)))=ca_snr_temp ca_rad_unc(*,hh(timind(nn-3:nn-1)))=fltarr(17,3)+(-9999.) ca_tot_rad_kr(hh(timind(0:nn-4)))=ca_tot_rad_temp ca_tot_rad_kr(hh(timind(nn-3:nn-1)))=-9999. wavelength(*,hh(timind(0:nn-4)))=waveavg wavelength(*,hh(timind(nn-3:nn-1)))=fltarr(17,3)+(-9999.) midtime(hh(timind(0:nn-4)))=midt midtime(hh(timind(nn-3:nn-1)))=-9999. planet_sun_vector_TG(*,hh(timind(0:nn-4)))=pl_sun_vec planet_sun_vector_TG(*,hh(timind(nn-3:nn-1)))=fltarr(3,3)+(-9999.) planet_SC_vector_TG(*,hh(timind(0:nn-4)))=pl_sc_vec planet_SC_vector_TG(*,hh(timind(nn-3:nn-1)))=fltarr(3,3)+(-9999.) boresight_unit_vector_center_TG(*,hh(timind(0:nn-4)))=bor_cent boresight_unit_vector_center_TG(*,hh(timind(nn-3:nn-1)))=fltarr(3,3)+(-9999.) boresight_unit_vector_c1_tg(*,hh(timind(0:nn-4)))=bor_c1 boresight_unit_vector_c1_tg(*,hh(timind(nn-3:nn-1)))=fltarr(3,3)+(-9999.) boresight_unit_vector_c2_tg(*,hh(timind(0:nn-4)))=bor_c2 boresight_unit_vector_c2_tg(*,hh(timind(nn-3:nn-1)))=fltarr(3,3)+(-9999.) target_latitude_set(*,hh(timind(0:nn-4)))=tarlat target_latitude_set(*,hh(timind(nn-3:nn-1)))=fltarr(5,3)+(-9999.) target_longitude_set(*,hh(timind(0:nn-4)))=tarlon target_longitude_set(*,hh(timind(nn-3:nn-1)))=fltarr(5,3)+(-9999.) target_altitude_set(*,hh(timind(0:nn-4)))=taralt target_altitude_set(*,hh(timind(nn-3:nn-1)))=fltarr(5,3)+(-9999.) subspacecraft_latitude(hh(timind(0:nn-4)))=spaclat subspacecraft_latitude(hh(timind(nn-3:nn-1)))=-9999. subspacecraft_longitude(hh(timind(0:nn-4)))=spaclon subspacecraft_longitude(hh(timind(nn-3:nn-1)))=-9999. subsolar_latitude(hh(timind(0:nn-4)))=subsollat subsolar_latitude(hh(timind(nn-3:nn-1)))=-9999. subsolar_longitude(hh(timind(0:nn-4)))=subsollon subsolar_longitude(hh(timind(nn-3:nn-1)))=-9999. true_anomaly(hh(timind(0:nn-4)))=tanomaly true_anomaly(hh(timind(nn-3:nn-1)))=-9999. obs_solar_localtime(hh(timind(0:nn-4)))=loct obs_solar_localtime(hh(timind(nn-3:nn-1)))=-9999. macro(hh(timind(nn-3:nn-1)))=-9999. filename(hh(timind(nn-3:nn-1)))=-9999. scan_num(hh(timind(nn-3:nn-1)))=-9999. obs_typ_num(hh(timind(nn-3:nn-1)))=-9999. obs_typ(hh(timind(nn-3:nn-1)))=-9999. obs_seq_index(hh(timind(nn-3:nn-1)))=-9999. slit(hh(timind(nn-3:nn-1)))=-9999. orb_num(hh(timind(nn-3:nn-1)))=-9999. ;Don't know what to do about time ; step_utc_time ; jd_obs ; yd_obs ; ymd_obs endfor skip2: endif endfor endfor ;stop ;Filter out -9999 to reindex from Surface slit averaging index=where(orb_num eq -9999.,complement=index1) midtime=midtime(index1) planet_sun_vector_TG=planet_sun_vector_tg(*,index1) planet_SC_vector_TG=planet_SC_vector_TG(*,index1) boresight_unit_vector_center_TG=boresight_unit_vector_center_TG(*,index1) boresight_unit_vector_c1_tg=boresight_unit_vector_c1_tg(*,index1) boresight_unit_vector_c2_tg=boresight_unit_vector_c2_tg(*,index1) target_latitude_set=target_latitude_set(*,index1) target_longitude_set=target_longitude_set(*,index1) target_altitude_set=target_altitude_set(*,index1) subspacecraft_latitude=subspacecraft_latitude(index1) subspacecraft_longitude=subspacecraft_longitude(index1) subsolar_latitude=subsolar_latitude(index1) subsolar_longitude=subsolar_longitude(index1) true_anomaly=true_anomaly(index1) step_utc_time=step_utc_time(index1) macro=macro(index1) filename=filename(index1) scan_num=scan_num(index1) obs_typ_num=obs_typ_num(index1) obs_typ=obs_typ(index1) obs_seq_index=obs_seq_index(index1) slit=slit(index1) orb_num=orb_num(index1) jd_obs=jd_obs(index1) yd_obs=yd_obs(index1) ymd_obs=ymd_obs(*,index1) ca_rad_kr=ca_rad_kr(*,index1) ca_rad_unc=ca_rad_unc(*,index1) wavelength=wavelength(*,index1) ca_tot_rad_kr=ca_tot_rad_kr(index1) ca_tot_rad_snr=ca_tot_rad_snr(index1) orig=orig(*,index1) obs_solar_localtime=obs_solar_localtime(index1) ;;;;;;;;END Ca surface slit averaging ;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Filter out bad scans ;index=where(ca_rad_kr(6,*) gt -100 and orig(16,*) ne 0 and orig(0,*) ne 0 and ca_rad_kr(0,*) gt -15) ;Added more extensive filtering Aug. 2013 ;Changed filtering Oct. 2013 ;Validated and changed filtering Feb. 2017 AWM ;This filtering works for all data except the first earth year. diff=orig(2,*)-orig(11,*) yy=where(orig(0,*) ne 0.00) yy2=where(diff(yy) lt 6.5e4 and diff(yy) gt -3e4) yy3=where(orig(11,yy(yy2)) ne 0.0) yy4=where(ca_tot_rad_kr(yy(yy2(yy3))) gt -15 and ca_tot_rad_kr(yy(yy2(yy3))) lt 40 and ca_tot_rad_snr(yy(yy2(yy3))) gt -5) index2=yy(yy2(yy3(yy4))) if j eq 0 then begin diff=orig(2,*)-orig(16,*) yy=where(orig(0,*) ne 0.00) yy2=where(orig(16,yy) ne 0.00) yy3=where(diff(yy(yy2)) lt 6.5e4 and diff(yy(yy2)) gt -8e4) yy4=where(ca_tot_rad_kr(yy(yy2(yy3))) gt -15 and ca_tot_rad_kr(yy(yy2(yy3))) lt 40 and ca_tot_rad_snr(yy(yy2(yy3))) gt -5) index2=yy(yy2(yy3(yy4))) endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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) ca_rad_kr=ca_rad_kr(*,index2) ca_rad_unc=ca_rad_unc(*,index2) wavelength=wavelength(*,index2) ca_tot_rad_kr=ca_tot_rad_kr(index2) ca_tot_rad_snr=ca_tot_rad_snr(index2) orig=orig(*,index2) obs_solar_localtime=obs_solar_localtime(index2) spacecraft_altitude=sqrt(planet_sc_vector_tg(0,*)^2+planet_sc_vector_tg(1,*)^2+planet_sc_vector_tg(2,*)^2)-2440. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;plot,altavg,loc,/ys,psym=-1 & print,obs_type(hh(timind)) ;plot,target_altitude_set(0,hh(timind)),ca_tot_rad_kr(hh(timind)) & oplot,altavg,ca_tot_rad_temp,color=250 ;plot,target_altitude_set(0,hh(timind)),ca_tot_rad_snr(hh(timind)) & oplot,altavg,ca_tot_snr_temp,color=250 ; for i=0,104 do begin plot,waveavg(*,i),origavg(*,i)-darkavg(*,i) & oplot,waveavg(*,i),sol_fit_temp(*,i),color=250 & wait,.5 ;for i=0,100 do begin plot,waveavg,ca_rad_temp(*,i) & oplot,waveavg(6:10),ca_rad_temp(6:10,i),color=250 & wait,.5 ;plot,altavg,loc,/ys,psym=-1 & print,obs_type(hh(timind(0))) & print,macro(hh(timind(0))) 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, ca_rad_kr, ca_rad_unc, wavelength, ca_tot_rad_kr, ca_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/CA,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, ca_rad_kr, ca_rad_unc, wavelength, ca_tot_rad_kr, ca_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/CA,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, ca_rad_kr, ca_rad_unc, wavelength, ca_tot_rad_kr, ca_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/CA,yearind process_perorbit_summaryfile,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, ca_rad_kr, ca_rad_unc, wavelength, ca_tot_rad_kr, ca_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/CA,yearind endfor return end ;----------------------------------------------------------------------------- ; * concat_mg_ddr_final - compiles all the magnesium data for the whole ; mission phase. There are 9 macro types (35,65,66,67,68,87,89,91,92,99) ; that can be used in operations to measure magnesium. This program calls ; a program that searches the cdr database by date for each macro. The ; program reorganizes the magnesium geometry and spectral information ; from the cdrs into a summary file as described in the UVVS 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_mg_ddr_final ;main code for UVVS Magnesium DDR 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=['MASCS20120330','MASCS20120331','MASCS20120401','MASCS20120402','MASCS20120403','MASCS20120404','MASCS20120405'] date2=[date2,'MASCS20120406','MASCS20120407','MASCS20120408','MASCS20120409','MASCS20210410','MASCS20210411','MASCS20210412','MASCS20120413'] date2=[date2,'MASCS20120414','MASCS20120415','MASCS20120416','MASCS20120417','MASCS20210418','MASCS20210419','MASCS20210420','MASCS20120421'] date2=[date2,'MASCS20120422','MASCS20120423','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'] ;['MASCS20120920','MASCS20120921','MASCS20120922','MASCS20120923''] date2=[date2,'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'] 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'] date3=[date3,'MASCS20130909','MASCS20130910','MASCS20130911','MASCS20130912','MASCS20130913','MASCS20130914','MASCS20130915','MASCS20130916'] date3=[date3,'MASCS20130917','MASCS20130918','MASCS20130919','MASCS20130920','MASCS20130921','MASCS20130922','MASCS20130923','MASCS20130924'] date3=[date3,'MASCS20130925','MASCS20130926','MASCS20130927','MASCS20130928','MASCS20130929','MASCS20130930','MASCS20131001','MASCS20131002'] date3=[date3,'MASCS20131003','MASCS20131004','MASCS20131005','MASCS20131006','MASCS20131007','MASCS20131008','MASCS20131009','MASCS20131010'] date3=[date3,'MASCS20131011','MASCS20131012','MASCS20131013','MASCS20131014','MASCS20131015','MASCS20131016','MASCS20131017','MASCS20131018'] date3=[date3,'MASCS20131019','MASCS20131020','MASCS20131021','MASCS20131022','MASCS20131023','MASCS20131024','MASCS20131025','MASCS20131026'] date3=[date3,'MASCS20131027','MASCS20131028','MASCS20131029','MASCS20131030','MASCS20131031','MASCS20131101','MASCS20131102','MASCS20131103'] date3=[date3,'MASCS20131104','MASCS20131105','MASCS20131106','MASCS20131107','MASCS20131108','MASCS20131109','MASCS20131110','MASCS20131111'] date3=[date3,'MASCS20131112','MASCS20131113','MASCS20131114','MASCS20131115','MASCS20131116','MASCS20131117','MASCS20131118','MASCS20131119'] date3=[date3,'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','MASCS20150122'] date5=['MASCS20150120','MASCS20150121','MASCS20150122'] 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','MASCS20150325' date5=[date5,'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. ADDED back in Dec. 2016 ;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 ; ADDED back in Dec. 2016 merkelpath = '/Volumes/mascs_data/APL_Merkel/cdr_products_new2/' merkelpath1 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm_new2/' merkelpath2 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm2_new2/' merkelpath3 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm3_new2/' merkelpath4 = '/Volumes/mascs_data/APL_Merkel/cdr_products_xm4_new2/' 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 for q=0,4 do begin ;; Loop over Earth years if q eq 0 then date=date1 if q eq 1 then date=date2 if q eq 2 then date = date3 if q eq 3 then date = date4 if q eq 4 then date =date5 dateind=n_elements(date) macro=n_elements(date) for dd=0,dateind-1 do begin if location eq 0 then begin xx=file_search(path+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path1+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path2+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path3+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*.sav') if xx(0) eq '' then xx=file_search(path4+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*.sav') endif if location eq 1 then begin xx=file_search(path+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path2+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path3+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path4+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,91,92}*_SCI.DAT') if xx(0) eq '' then xx=file_search(path5+date(dd)+'/UVVS/VIS/'+'*_{35,99,65,66,67,68,87,89,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, 'MAGNESIUM' ;changed to case statements: RCE 11/09/2012 macro_int = fix(macrotop) case macro_int of 35: begin open_mac35_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 99: begin open_mac99_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 65: begin open_mac65_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 66: begin open_mac66_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 67: begin open_mac67_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 68: begin open_mac68_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 87: begin open_mac87_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 89: begin open_mac89_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 91: begin open_mac91_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 end 92: begin open_mac92_mg_DDR,xx(i),location,mg_rad_kr6,mg_rad_unc6,wvl6,mg_tot_rad_kr6,mg_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,dark6,sol_fit6 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]] dark=[[dark6]] sol_fit=[[sol_fit6]] jd_obs=[jd_obs6] yd_obs=[yd_obs6] ymd_obs=[[ymd_obs6]] mg_rad_kr=[[mg_rad_kr6]] mg_rad_unc=[[mg_rad_unc6]] wavelength=[[wvl6]] mg_tot_rad_kr=[mg_tot_rad_kr6] mg_tot_rad_unc=[mg_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] jd_obs=[jd_obs,jd_obs6] yd_obs=[yd_obs,yd_obs6] ymd_obs=[[ymd_obs],[ymd_obs6]] orig=[[orig],[orig6]] dark=[[dark],[dark6]] sol_fit=[[sol_fit],[sol_fit6]] mg_rad_kr=[[mg_rad_kr],[mg_rad_kr6]] mg_rad_unc=[[mg_rad_unc],[mg_rad_unc6]] wavelength=[[wavelength],[wvl6]] mg_tot_rad_kr=[mg_tot_rad_kr,mg_tot_rad_kr6] mg_tot_rad_unc=[mg_tot_rad_unc,mg_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) jd_obs=jd_obs(index) yd_obs=yd_obs(index) ymd_obs=ymd_obs(*,index) orig=orig(*,index) dark=dark(*,index) sol_fit=sol_fit(*,index) mg_rad_kr=mg_rad_kr(*,index) mg_rad_unc=mg_rad_unc(*,index) wavelength=wavelength(*,index) mg_tot_rad_kr=mg_tot_rad_kr(index) mg_tot_rad_snr=mg_tot_rad_unc(index) ;localtime 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) minalt=fltarr(n_elements(index)) for t=0,n_elements(index)-1 do minalt(t)=min(target_altitude_set(*,t)) ;;;;;remove spaces on observation_type so usable in searches obs_type=strarr(n_elements(obs_typ)) nel=n_elements(obs_typ) for s=0,nel-1 do begin obs_type(s)=strtrim(obs_typ(s),2) endfor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Correct dayside limb scans for Mg: added AWM Oct. 2016 ;if q ge 2 then begin restore,'Ovis_cn_taa_loc_orb_data.sav' utc=step_utc_time restore,'kurucz_forwardmodel_wavelength_shift_19steps.sav' scalemg=[.96,.98,.99,1.001,1.001,.99,.99,.999,.9999,.99999,.95,.95,.99,1.0,1.01,1.0,.99,.99,1.,1.,.98] sub_scat=fltarr(17,473200) ;origmdark=orig-dark mgind=findgen(17)+388 kurnew=uvvs_kurucz for i=0,18 do kurnew(mgind(0:16),i)=uvvs_kurucz(mgind(0:16),i) *scalemg wavelength_scale,test,ind,'VIS' range1=[test(734),test(750)]/10 range35=[test(736),test(752)]/10 indd=17 solind_orig=where(uvvs_kuwl gt range1(0)-.1 and uvvs_kuwl lt range1(1)+.1) solo=kurnew(solind_orig,*) wvlo=uvvs_kuwl(solind_orig) solind_35=where(uvvs_kuwl gt range35(0)-.1 and uvvs_kuwl lt range35(1)+.1) sol35=kurnew(solind_35,*) wvl35=uvvs_kuwl(solind_35) sol35(11,0:8)=sol35(11,0:8)*.98 sol35(11,9:18)=sol35(11,9:18)*.96 sol35(10,0:7)=sol35(10,0:7)*.975 sol35(10,9:18)=sol35(10,9:18)*.98 sol35(0,*)=sol35(0,*)*1.02 sol35(1,*)=sol35(1,*)*.98 sol35(7,*)=sol35(7,*)*1.01 sol35(8,*)=sol35(8,*)*1.01 num=n_elements(orb_num) c=fltarr(17,num) sol_fit_new=sol_fit ;c_corr_uncert_new=corr_uncert mg_rad_kr_new=mg_rad_kr mg_rad_snr_new=mg_rad_unc mg_tot_rad_kr_new=mg_tot_rad_kr mg_tot_rad_snr_new=mg_tot_rad_snr ;dark_percent_new=dark_percent ;solscat_percent_new=solscat_percent orbind=n_elements(orb_num) orb1=820 ; orbit at the start of XM, not correcting NM data. orb2=3978 ;Last orbit of XM3, not correcting XM4 for m=orb1,orb2 do begin ;;;open correction for Mg. If XM2 then open gridded_correction_final_V2_sept2016.sav ;;;If XM and XM3 then open gridded_correction_final_V2_forxm3.sav if m gt 1802 and m le 2898 then begin restore,'gridded_correction_final_V2_sept2016.sav' ; print,'V2_sept2016',m endif else begin restore,'gridded_correction_final_V2_sept2016_xm_xm3.sav' ;print,'forxm3',m endelse ; hh=where(orb_num eq m and obs_typ_num eq 1 and slit eq 1) hh=where(orb_num eq m and obs_type eq 'UVVSDaysideScan' and slit eq 1) if hh(0) ne -1 then begin loc=obs_solar_localtime(hh) malt=minalt(hh) taa=true_anomaly(hh) date=strcompress(string(yd_obs(hh)),/remove_all) yyddd=(strmid(date,2,5)) for k=6,18 do begin timind=where(loc gt k-.5 and loc le k+.5 and malt gt 0 ) if timind(0) ne -1 then begin if k eq 6 then grid=grid6s if k eq 7 then grid=grid8s if k eq 8 then grid=grid8s if k eq 9 then grid=grid8s if k eq 10 then grid=grid10s if k eq 11 then grid=grid10s if k eq 12 then grid=grid12s if k eq 13 then grid=grid12s if k eq 14 then grid=grid14s if k eq 15 then grid=grid16s if k eq 16 then grid=grid16s if k eq 17 then grid=grid16s if k eq 18 then grid=grid18s tt=min(abs(taagrid+5-taa(timind(0))),taaind) ;Need to add per year if k eq 6 and m le 1802 then grid(*,17:24,0:2)=grid(*,17:24,0:2)*.2 if k eq 18 and m le 1802 then begin grid(*,16:23,0:2)=grid(*,16:23,0:2)*0. grid(*,29:35,0:2)=grid(*,29:35,0:2)*0. endif gridint=interpol(reverse(grid(*,taaind)),reverse(gridalt),malt(timind)) if k eq 6 or k eq 18 then begin if n_elements(timind) le 91 then gridint=interpol(reverse(grid(*,taaind,0)),reverse(gridalt),malt(timind)) if n_elements(timind) le 91 and (k eq 6 ) then begin ll=where(malt(timind) gt 0) yy=min(malt(timind(ll)),b) mm=min(abs(loc(timind(ll(b)))-loc6s(taaind,*)),m1) gridint=interpol(reverse(grid(*,taaind,m1)),reverse(gridalt),malt(timind)) endif if n_elements(timind) le 91 and k eq 18 then begin ll=where(malt(timind) gt 0) yy=min(malt(timind(ll)),b) mm=min(abs(loc(timind(ll(b)))-loc18s(taaind,*)),m1) gridint=interpol(reverse(grid(*,taaind,m1)),reverse(gridalt),malt(timind)) endif if n_elements(timind) gt 91 then begin if k eq 6 then loct=loc6s if k eq 18 then loct = loc18s ll=where(malt(timind(0:90)) gt 0) yy=min(malt(timind(ll)),b1) mm=min(abs(loc(timind(ll(b1)))-loct(taaind,*)),m1) ll2=where(malt(timind(91:*)) gt 0) ll2=ll2+91 yy=min(malt(timind(ll2)),b2) mm=min(abs(loc(timind(ll2(b2)))-loct(taaind,*)),m2) gridint(0:90)=interpol(reverse(grid(*,taaind,m1)),reverse(gridalt),malt(timind(0:90))) gridint(91:*)=interpol(reverse(grid(*,taaind,m2)),reverse(gridalt),malt(timind(91:*))) endif endif if m eq 3319 and k eq 18 then gridint(0:n_elements(timind)-1)=0 if m eq 3804 and k eq 18 then gridint(0:0:n_elements(timind)-1)=0 darksub=orig(*,hh(timind))-dark(*,hh(timind)) for y=0,16 do sub_scat(y,hh(timind))=gridint c=darksub for t=0,n_elements(timind)-1 do begin if total(darksub(15:16,t)) eq 0.0 then darksub(where(darksub(*,t) eq 0),t)=!values.F_NAN c(*,t)=darksub(*,t)-gridint(t) endfor ; for t=0,n_elements(timind)-1 do origmdark(*,hh(timind(t)))=darksub(*,t)-gridint(t) c_sub=c dark_std=10+sqrt(dark(*,hh(timind))*4) ;if k eq 6 then begin ;plot,malt((timind)),darksub(0,*),title='TAA '+strcompress(taa(timind(0)))+' LT '+strcompress(k) +' ORB '+strcompress(m) ;if k gt 7 and k lt 17 then oplot,gridalt,grid(*,taaind),color=250 ;if k eq 6 or k eq 18 then oplot,gridalt,grid(*,taaind,m1),color=250 ;oplot,malt((timind)),c(0,*) ;oplot,malt(timind),gridint,color=170,psym=-1 ;stop ;endif b_corr=fltarr(n_elements(timind)) d=fltarr(n_elements(timind)) ss_temp=fltarr(17,19,n_elements(timind)) sol_dev=fltarr(17,19,n_elements(timind)) sol_dev_new=fltarr(17,n_elements(timind)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; for i=0,n_elements(timind)-1 do begin corr=fltarr(19) iind=[1,2,3,4,indd-5,indd-4,indd-3,indd-2] kk=where(finite(c_sub(*,i)) eq 0) kk2=where(finite(c_sub(*,i)) eq 1) if n_elements(kk) ge 4 and kk(0) ne -1 then iind=[1,2,3,4,indd-6,indd-5] if n_elements(kk) le 2 and kk(0) ne -1 then iind=[1,2,3,4,5,indd-6,indd-5,indd-4,indd-3] sol=solo wvl=wvlo if macro(hh(timind(i))) eq 35 and wavelength(0,hh(timind(i))) gt 283.9 then begin iind=[0,1,2,3,indd-8,indd-7,indd-6,indd-5,indd-4] sol=sol35 wvl=wvl35 endif ;if I need to add for wavelength anomaly ;if utc(i) gt '12090T19:08:24.00' and utc(i) lt '12107T15:00:00.00' then begin ;if utc(i) gt '13249T12:03:40.00' and utc(i) lt '13326T15:58:54.00' then begin ;;;;;;;;;;;;;;;;;; ;spi_ind=[0,1,2,3,indd-4,indd-3,indd-2,indd-1] ;mm=mean(c(spi_ind,i)) ;ss=stddev(c(spi_ind,i)) ;jj=where(c(spi_ind,i) gt mm+(2*ss) or c(spi_ind,i) lt mm-(2*ss)) ;if jj(0) ne -1 then c_sub(spi_ind(jj),i) = mm for j=0,18 do begin x_data=wavelength[iind,hh(timind(i))] x_data_bar=mean(wavelength[iind,hh(timind(i))]) x=x_data-x_data_bar y_data=reform(c_sub[iind,i])/sol[iind,j] y_data_bar=mean(y_data) y=y_data-y_data_bar coeffs = linfit(x,y,sigma=sigma,/double) ss_temp[*,j,i] = sol(*,j) * (coeffs[0] + coeffs[1] * (wavelength(*,hh(timind(i)))-x_data_bar) + y_data_bar) sol_dev(*,j,i)=sol(*,j)*sqrt(sigma(0)*sigma(0)+sigma(1)*sigma(1)*(wavelength(*,hh(timind(i)))-x_data_bar)*(wavelength(*,hh(timind(i)))-x_data_bar)) ;Only correlate real numbers not NAN corr(j)=correlate(c_sub(kk2,i),ss_temp(kk2,j,i)) endfor d(i)=max(abs(corr)) ind=!c sol_fit_new(*,hh(timind(i)))=ss_temp(*,ind,i) sol_dev_new(*,i)=sol_dev(*,ind,i) b_corr(i)=ind ;if macro(hh(timind(i))) eq 65 then stop ;if k eq 16 and i gt 70 then stop ;if k eq 12 then begin ;plot,wavelength(*,hh(timind(i))),darksub(*,i) & oplot,wavelength(*,hh(timind(i))),sol_fit(*,hh(timind(i))),psym=-1 & oplot,wavelength(*,hh(timind(i))),sol_fit_new(*,hh(timind(i))),psym=-1,color=250 & oplot,wavelength(*,hh(timind(i))),c_sub(*,i),psym=-1,color=100 ;stop ;endif c_corr_uncert=sqrt(orig(*,hh(timind(i)))*4.+dark_std(*,i)*dark_std(*,i)+sol_dev_new(*,i)*sol_dev_new(*,i)) UVVS_sensitivity,'VIS',slit(hh(timind(i))),wavelength(*,hh(timind(i))),sensin0 uvvs_sensitivity_correction_dec2016,yyddd(timind(i)),'VIS',wavelength(*,hh(timind(i))),sensin0,sens0 ;uvvs_sensitivity_correction_oct2013,'VIS',wavelength(*,hh(timind(i))),sensin0,sens0 mg_rad_kr_new(*,hh(timind(i)))=(c(*,i)-sol_fit_new(*,hh(timind(i))))/sens0 mg_rad_snr_new(*,i)=abs(c(*,i)-sol_fit_new(*,hh(timind(i))))/(c_corr_uncert) mg_wrange = (total(wavelength[7:10,0]) - total(wavelength[6:9,0])) / 4.0 if wavelength(0,hh(timind(i))) lt 283.7 then begin mg_tot_rad_kr_new(hh(timind(i)))=total(mg_rad_kr_new[5:11,hh(timind(i))],1) * mg_wrange mg_tot_rad_snr_new(hh(timind(i)))= total((c[5:11,i]-sol_fit_new[5:11,hh(timind(i))]),1)/sqrt(total(c_corr_uncert[5:11]^2,1)) endif else begin mg_tot_rad_kr_new(hh(timind(i)))=total(mg_rad_kr_new[3:9,hh(timind(i))],1) * mg_wrange mg_tot_rad_snr_new(hh(timind(i)))= total((c[3:9,i]-sol_fit_new[3:9,hh(timind(i))]),1)/sqrt(total(c_corr_uncert[3:9]^2,1)) endelse endfor ;To fix the first altitude problem, it is negative nn=n_elements(timind) if nn lt 91 then begin if mg_tot_rad_kr_new(hh(timind(nn-1))) lt .5 then mg_tot_rad_kr_new(hh(timind(nn-1)))=mg_tot_rad_kr_new(hh(timind(nn-2))) endif ;plot,malt(timind),mg_tot_rad_kr(hh(timind)),title='TAA '+strcompress(taa(timind(0)))+' LT '+strcompress(k) +' ORB '+strcompress(m) ;oplot,malt(timind),mg_tot_rad_kr_new(hh(timind)),color=250 ;if m eq 1802 then stop endif if n_elements(timind) gt 0 and timind(0) ne -1 then begin rad_new=mg_rad_kr_new(*,hh(timind)) snr_new=mg_rad_snr_new(*,hh(timind)) qq2=where(finite(rad_new) eq 0) if qq2(0) ne -1 then begin rad_new(qq2)=0.0 snr_new(qq2)=0.0 mg_rad_kr_new(*,hh(timind))=rad_new mg_rad_snr_new(*,hh(timind))=snr_new endif endif endfor endif endfor mg_rad_kr=mg_rad_kr_new mg_rad_unc=mg_rad_snr_new mg_tot_rad_kr=mg_tot_rad_kr_new mg_tot_rad_snr=mg_tot_rad_snr_new ;endif ;If statement to only do XM and beyond for solar correction. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Filter out bad scans ;More extensive filtering added Aug. 2013 if q eq 0 then begin diff=orig(2,*)-orig(11,*) yy=where(total(orig(0:1,*),1) ne 0.00) yy2=where(total(orig(10:11,yy),1) ne 0.00) yy3=where(diff(yy(yy2)) lt .5e4 and diff(yy(yy2)) gt -1.e4) yy4=where(mg_tot_rad_kr(yy(yy2(yy3))) gt -3) yy5=where(mg_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -3) index2=yy(yy2(yy3(yy4(yy5)))) endif ;if q eq 0 then begin ;diff=orig(2,*)-orig(11,*) ;yy=where(total(orig(0:1,*),1) ne 0.00) ;yy2=where(total(orig(10:11,yy),1) ne 0.00) ;yy4=where(orig(11,yy(yy2)) lt 6e4) ;yy42=where(orig(0,yy(yy2(yy4))) lt 4e4) ;yy5=where(diff(yy(yy2(yy4(yy42)))) lt .1e4 and diff(yy(yy2(yy4(yy42)))) gt -1.2e4) ;yy6=where(mg_tot_rad_kr(yy(yy2(yy4(yy42(yy5))))) gt -3 and mg_tot_rad_snr(yy(yy2(yy4(yy42(yy5))))) gt -3) ;index2=yy(yy2(yy4(yy42(yy5(yy6))))) ;endif if q eq 1 then begin diff=orig(2,*)-orig(11,*) yy=where(total(orig(0:1,*),1) ne 0.00) yy2=where(total(orig(10:11,yy),1) ne 0.00) yy3=where(diff(yy(yy2)) lt .5e4 and diff(yy(yy2)) gt -1e5 and orig(12,yy(yy2)) gt 0) yy4=where(mg_tot_rad_kr(yy(yy2(yy3))) gt -5 and mg_tot_rad_kr(yy(yy2(yy3))) le 100) yy5=where(mg_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -3) index2=yy(yy2(yy3(yy4(yy5)))) endif if q eq 2 then begin diff=orig(2,*)-orig(11,*) yy=where(total(orig(0:1,*),1) ne 0.00) yy2=where(total(orig(10:11,yy),1) ne 0.00) yy3=where(diff(yy(yy2)) lt 2e4 and diff(yy(yy2)) gt -1.2e4 ) yy4=where(mg_tot_rad_kr(yy(yy2(yy3))) gt -4 and mg_tot_rad_kr(yy(yy2(yy3))) le 100) yy5=where(mg_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -4) index2=yy(yy2(yy3(yy4(yy5)))) endif if q eq 3 then begin diff=orig(2,*)-orig(11,*) yy=where(total(orig(0:1,*),1) ne 0.00) yy2=where(total(orig(10:11,yy),1) ne 0.00) yy3=where(diff(yy(yy2)) lt 4e4 and diff(yy(yy2)) gt -1.2e4 ) yy4=where(mg_tot_rad_kr(yy(yy2(yy3))) gt -3 and mg_tot_rad_kr(yy(yy2(yy3))) le 100) yy5=where(mg_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -4) index2=yy(yy2(yy3(yy4(yy5)))) endif if q eq 4 then begin diff=orig(2,*)-orig(11,*) yy=where(total(orig(0:1,*),1) ne 0.00) yy2=where(total(orig(10:11,yy),1) ne 0.00) yy3=where(diff(yy(yy2)) lt 1e4 and diff(yy(yy2)) gt -1.e4 ) yy4=where(mg_tot_rad_kr(yy(yy2(yy3))) gt -3 and mg_tot_rad_kr(yy(yy2(yy3))) le 100) yy5=where(mg_tot_rad_snr(yy(yy2(yy3(yy4)))) gt -4) index2=yy(yy2(yy3(yy4(yy5)))) endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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) mg_rad_kr=mg_rad_kr(*,index2) mg_rad_unc=mg_rad_unc(*,index2) wavelength=wavelength(*,index2) mg_tot_rad_kr=mg_tot_rad_kr(index2) mg_tot_rad_snr=mg_tot_rad_snr(index2) obs_solar_localtime=obs_solar_localtime(index2) spacecraft_solar_localtime=spacecraft_solar_localtime(index2) ;orig=orig(*,index2) ;Calculate spacecraft altitude spacecraft_altitude=sqrt(planet_sc_vector_tg(0,*)^2+planet_sc_vector_tg(1,*)^2+planet_sc_vector_tg(2,*)^2)-2440. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;save interim sav file in case Aimee has to update the process code ;save, 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, mg_rad_kr, mg_rad_unc, wavelength, mg_tot_rad_kr, mg_tot_rad_snr,obs_solar_localtime,$ ; orb_num,spacecraft_altitude,spacecraft_solar_localtime,filename='Mg_interimfile_ddr.sav' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; yearind=q 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, mg_rad_kr, mg_rad_unc, wavelength, mg_tot_rad_kr, mg_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/MG,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, mg_rad_kr, mg_rad_unc, wavelength, mg_tot_rad_kr, mg_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/MG,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, mg_rad_kr, mg_rad_unc, wavelength, mg_tot_rad_kr, mg_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/MG,yearind process_perorbit_summaryfile,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, mg_rad_kr, mg_rad_unc, wavelength, mg_tot_rad_kr, mg_tot_rad_snr,obs_solar_localtime,$ orb_num,spacecraft_altitude,spacecraft_solar_localtime,/MG,yearind endfor return end