;+
;
; mms_hpca_eis_combined_crib
;
; This crib sheet shows how to create a spectra plot with EIS and HPCA data
; on the same panel
;
; ***** WARNING ON USING THIS CRIB SHEET *****
; The EPD and HPCA instrument teams have not fully investigated the 
; cross-calibration of these instruments; combining these spectra 
; should be done on a case-by-case basis. Please contact the instrument 
; teams before combining data from the EPD and plasma instruments.
;
;
; $LastChangedBy: egrimes $
; $LastChangedDate: 2018-02-07 09:04:36 -0800 (Wed, 07 Feb 2018) $
; $LastChangedRevision: 24662 $
; $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_3_00/projects/mms/examples/advanced/mms_hpca_eis_combined_crib.pro $
;-

mms_load_hpca, trange=['2015-10-16', '2015-10-17'], datatype='ion', probe=1

mms_hpca_calc_anodes, fov=[0, 360]
mms_hpca_spin_sum, probe='1'

mms_load_eis, trange=['2015-10-16', '2015-10-17'], datatype='extof', probe=1

get_data, 'mms1_epd_eis_extof_proton_flux_omni_spin', data=d, dlimits=dl

; convert the EIS data to eV so the 2 data products are on the same scale
d.V = d.V*1000d 

; resave the EIS proton flux in eV
store_data, 'mms1_epd_eis_extof_proton_flux_omni_spin', data=d

store_data, 'combined_flux', data='mms1_epd_eis_extof_proton_flux_omni_spin mms1_hpca_hplus_flux_elev_0-360_spin'

; be sure to set the plot metadata on the combined spectra
options, 'combined_flux', ylog=1, yrange=[1, 1e7], ystyle=1, yticks=7, zrange=[0.1, 1e7]
options, 'combined_flux', ztitle='H+ Flux (cm!U2!N s sr eV)!U-1!N', ytitle='EIS - HPCA', ysubtitle='[eV]'

; potential cross-calibration issue here; please contact the instrument teams before trusting these results
tplot, 'combined_flux'

stop

end