;+ ;PROCEDURE: thm_load_esa_pot ;PURPOSE: ; Add magnetometer data to the ESA structures ;INPUT: ; ;KEYWORDS: ; sc: string themis spacecraft - "a", "b", "c", "d", "e" ; if not set defaults to "a" ; themishome: string path to data dir, where data dir contains the th* dir, where *=a,b,c,d,e ; ; ;CREATED BY: J. McFadden ;VERSION: 1 ;LAST MODIFICATION: 07/06/22 ;MOD HISTORY: ; ;NOTES: ; ;- pro thm_load_esa_pot,sc=sc,themishome=themishome,pot_scale=pot_scale,offset=offset,min_pot=min_pot,make_plot=make_plot ; sc default if not keyword_set(sc) then begin print,'S/C number not set, default = all probes' sc=['a','b','c','d','e'] endif if not keyword_set(themishome) then themishome=!themis.local_data_dir nsc = n_elements(sc) probes=strarr(1) if nsc eq 1 then probes(0)=sc if nsc ne 1 then probes=sc if not keyword_set(pot_scale) then scale=1.15 else scale=pot_scale if not keyword_set(offset) then offset=1.0 if not keyword_set(min_pot) then min_pot=2.0 ;*********************************************************************************** ; get s/c potential data ; 1.6028 = 1 + 217/360 times spin_period is the spin offset time between s/c pot in moments and actual time s/c potential calculated for i=0,nsc-1 do begin thm_load_mom,probe=probes(i) get_data,'th'+probes(i)+'_pxxm_pot',data=tmp if probes(i) eq 'a' then begin common tha_454,tha_454_ind,tha_454_dat if n_elements(tha_454_dat) ne 0 then begin time=(tha_454_dat.time+tha_454_dat.end_time)/2.+1.6028*tha_454_dat.delta_t pot = interp(tmp.y,tmp.x,time) tha_454_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'tha_peif_sc_pot',data={x:time,y:tha_454_dat.sc_pot} endif common tha_455,tha_455_ind,tha_455_dat if n_elements(tha_455_dat) ne 0 then begin time=(tha_455_dat.time+tha_455_dat.end_time)/2.+1.6028*tha_455_dat.delta_t pot = interp(tmp.y,tmp.x,time) tha_455_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'tha_peir_sc_pot',data={x:time,y:tha_455_dat.sc_pot} endif common tha_456,tha_456_ind,tha_456_dat if n_elements(tha_456_dat) ne 0 then begin time=(tha_456_dat.time+tha_456_dat.end_time)/2.+1.6028*tha_456_dat.delta_t pot = interp(tmp.y,tmp.x,time) tha_456_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'tha_peib_sc_pot',data={x:time,y:tha_456_dat.sc_pot} endif common tha_457,tha_457_ind,tha_457_dat if n_elements(tha_457_dat) ne 0 then begin time=(tha_457_dat.time+tha_457_dat.end_time)/2.+1.6028*tha_457_dat.delta_t pot = interp(tmp.y,tmp.x,time) tha_457_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'tha_peef_sc_pot',data={x:time,y:tha_457_dat.sc_pot} endif common tha_458,tha_458_ind,tha_458_dat if n_elements(tha_458_dat) ne 0 then begin time=(tha_458_dat.time+tha_458_dat.end_time)/2.+1.6028*tha_458_dat.delta_t pot = interp(tmp.y,tmp.x,time) tha_458_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'tha_peer_sc_pot',data={x:time,y:tha_458_dat.sc_pot} endif common tha_459,tha_459_ind,tha_459_dat if n_elements(tha_459_dat) ne 0 then begin time=(tha_459_dat.time+tha_459_dat.end_time)/2.+1.6028*tha_459_dat.delta_t pot = interp(tmp.y,tmp.x,time) tha_459_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'tha_peeb_sc_pot',data={x:time,y:tha_459_dat.sc_pot} endif endif else if probes(i) eq 'b' then begin common thb_454,thb_454_ind,thb_454_dat if n_elements(thb_454_dat) ne 0 then begin time=(thb_454_dat.time+thb_454_dat.end_time)/2.+1.6028*thb_454_dat.delta_t pot = interp(tmp.y,tmp.x,time) thb_454_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thb_peif_sc_pot',data={x:time,y:thb_454_dat.sc_pot} endif common thb_455,thb_455_ind,thb_455_dat if n_elements(thb_455_dat) ne 0 then begin time=(thb_455_dat.time+thb_455_dat.end_time)/2.+1.6028*thb_455_dat.delta_t pot = interp(tmp.y,tmp.x,time) thb_455_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thb_peir_sc_pot',data={x:time,y:thb_455_dat.sc_pot} endif common thb_456,thb_456_ind,thb_456_dat if n_elements(thb_456_dat) ne 0 then begin time=(thb_456_dat.time+thb_456_dat.end_time)/2.+1.6028*thb_456_dat.delta_t pot = interp(tmp.y,tmp.x,time) thb_456_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thb_peib_sc_pot',data={x:time,y:thb_456_dat.sc_pot} endif common thb_457,thb_457_ind,thb_457_dat if n_elements(thb_457_dat) ne 0 then begin time=(thb_457_dat.time+thb_457_dat.end_time)/2.+1.6028*thb_457_dat.delta_t pot = interp(tmp.y,tmp.x,time) thb_457_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thb_peef_sc_pot',data={x:time,y:thb_457_dat.sc_pot} endif common thb_458,thb_458_ind,thb_458_dat if n_elements(thb_458_dat) ne 0 then begin time=(thb_458_dat.time+thb_458_dat.end_time)/2.+1.6028*thb_458_dat.delta_t pot = interp(tmp.y,tmp.x,time) thb_458_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thb_peer_sc_pot',data={x:time,y:thb_458_dat.sc_pot} endif common thb_459,thb_459_ind,thb_459_dat if n_elements(thb_459_dat) ne 0 then begin time=(thb_459_dat.time+thb_459_dat.end_time)/2.+1.6028*thb_459_dat.delta_t pot = interp(tmp.y,tmp.x,time) thb_459_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thb_peeb_sc_pot',data={x:time,y:thb_459_dat.sc_pot} endif endif else if probes(i) eq 'c' then begin common thc_454,thc_454_ind,thc_454_dat if n_elements(thc_454_dat) ne 0 then begin time=(thc_454_dat.time+thc_454_dat.end_time)/2.+1.6028*thc_454_dat.delta_t pot = interp(tmp.y,tmp.x,time) thc_454_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thc_peif_sc_pot',data={x:time,y:thc_454_dat.sc_pot} endif common thc_455,thc_455_ind,thc_455_dat if n_elements(thc_455_dat) ne 0 then begin time=(thc_455_dat.time+thc_455_dat.end_time)/2.+1.6028*thc_455_dat.delta_t pot = interp(tmp.y,tmp.x,time) thc_455_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thc_peir_sc_pot',data={x:time,y:thc_455_dat.sc_pot} endif common thc_456,thc_456_ind,thc_456_dat if n_elements(thc_456_dat) ne 0 then begin time=(thc_456_dat.time+thc_456_dat.end_time)/2.+1.6028*thc_456_dat.delta_t pot = interp(tmp.y,tmp.x,time) thc_456_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thc_peib_sc_pot',data={x:time,y:thc_456_dat.sc_pot} endif common thc_457,thc_457_ind,thc_457_dat if n_elements(thc_457_dat) ne 0 then begin time=(thc_457_dat.time+thc_457_dat.end_time)/2.+1.6028*thc_457_dat.delta_t pot = interp(tmp.y,tmp.x,time) thc_457_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thc_peef_sc_pot',data={x:time,y:thc_457_dat.sc_pot} endif common thc_458,thc_458_ind,thc_458_dat if n_elements(thc_458_dat) ne 0 then begin time=(thc_458_dat.time+thc_458_dat.end_time)/2.+1.6028*thc_458_dat.delta_t pot = interp(tmp.y,tmp.x,time) thc_458_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thc_peer_sc_pot',data={x:time,y:thc_458_dat.sc_pot} endif common thc_459,thc_459_ind,thc_459_dat if n_elements(thc_459_dat) ne 0 then begin time=(thc_459_dat.time+thc_459_dat.end_time)/2.+1.6028*thc_459_dat.delta_t pot = interp(tmp.y,tmp.x,time) thc_459_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thc_peeb_sc_pot',data={x:time,y:thc_459_dat.sc_pot} endif endif else if probes(i) eq 'd' then begin common thd_454,thd_454_ind,thd_454_dat if n_elements(thd_454_dat) ne 0 then begin time=(thd_454_dat.time+thd_454_dat.end_time)/2.+1.6028*thd_454_dat.delta_t pot = interp(tmp.y,tmp.x,time) thd_454_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thd_peif_sc_pot',data={x:time,y:thd_454_dat.sc_pot} endif common thd_455,thd_455_ind,thd_455_dat if n_elements(thd_455_dat) ne 0 then begin time=(thd_455_dat.time+thd_455_dat.end_time)/2.+1.6028*thd_455_dat.delta_t pot = interp(tmp.y,tmp.x,time) thd_455_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thd_peir_sc_pot',data={x:time,y:thd_455_dat.sc_pot} endif common thd_456,thd_456_ind,thd_456_dat if n_elements(thd_456_dat) ne 0 then begin time=(thd_456_dat.time+thd_456_dat.end_time)/2.+1.6028*thd_456_dat.delta_t pot = interp(tmp.y,tmp.x,time) thd_456_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thd_peib_sc_pot',data={x:time,y:thd_456_dat.sc_pot} endif common thd_457,thd_457_ind,thd_457_dat if n_elements(thd_457_dat) ne 0 then begin time=(thd_457_dat.time+thd_457_dat.end_time)/2.+1.6028*thd_457_dat.delta_t pot = interp(tmp.y,tmp.x,time) thd_457_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thd_peef_sc_pot',data={x:time,y:thd_457_dat.sc_pot} endif common thd_458,thd_458_ind,thd_458_dat if n_elements(thd_458_dat) ne 0 then begin time=(thd_458_dat.time+thd_458_dat.end_time)/2.+1.6028*thd_458_dat.delta_t pot = interp(tmp.y,tmp.x,time) thd_458_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thd_peer_sc_pot',data={x:time,y:thd_458_dat.sc_pot} endif common thd_459,thd_459_ind,thd_459_dat if n_elements(thd_459_dat) ne 0 then begin time=(thd_459_dat.time+thd_459_dat.end_time)/2.+1.6028*thd_459_dat.delta_t pot = interp(tmp.y,tmp.x,time) thd_459_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'thd_peeb_sc_pot',data={x:time,y:thd_459_dat.sc_pot} endif endif else if probes(i) eq 'e' then begin common the_454,the_454_ind,the_454_dat if n_elements(the_454_dat) ne 0 then begin time=(the_454_dat.time+the_454_dat.end_time)/2.+1.6028*the_454_dat.delta_t pot = interp(tmp.y,tmp.x,time) the_454_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'the_peif_sc_pot',data={x:time,y:the_454_dat.sc_pot} endif common the_455,the_455_ind,the_455_dat if n_elements(the_455_dat) ne 0 then begin time=(the_455_dat.time+the_455_dat.end_time)/2.+1.6028*the_455_dat.delta_t pot = interp(tmp.y,tmp.x,time) the_455_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'the_peir_sc_pot',data={x:time,y:the_455_dat.sc_pot} endif common the_456,the_456_ind,the_456_dat if n_elements(the_456_dat) ne 0 then begin time=(the_456_dat.time+the_456_dat.end_time)/2.+1.6028*the_456_dat.delta_t pot = interp(tmp.y,tmp.x,time) the_456_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'the_peib_sc_pot',data={x:time,y:the_456_dat.sc_pot} endif common the_457,the_457_ind,the_457_dat if n_elements(the_457_dat) ne 0 then begin time=(the_457_dat.time+the_457_dat.end_time)/2.+1.6028*the_457_dat.delta_t pot = interp(tmp.y,tmp.x,time) the_457_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'the_peef_sc_pot',data={x:time,y:the_457_dat.sc_pot} endif common the_458,the_458_ind,the_458_dat if n_elements(the_458_dat) ne 0 then begin time=(the_458_dat.time+the_458_dat.end_time)/2.+1.6028*the_458_dat.delta_t pot = interp(tmp.y,tmp.x,time) the_458_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'the_peer_sc_pot',data={x:time,y:the_458_dat.sc_pot} endif common the_459,the_459_ind,the_459_dat if n_elements(the_459_dat) ne 0 then begin time=(the_459_dat.time+the_459_dat.end_time)/2.+1.6028*the_459_dat.delta_t pot = interp(tmp.y,tmp.x,time) the_459_dat.sc_pot=scale*(pot+offset) > min_pot if keyword_set(make_plot) then store_data,'the_peeb_sc_pot',data={x:time,y:the_459_dat.sc_pot} endif endif endfor end