;+ ;NAME: ;thm_ui_plot_data ;PURPOSE: ;This will call instrument-level summary plot routines, such as ;thm_gmag_stackplot from the themis_w routine ;CALLING SEQUENCE: ;thm_ui_plot_data, state, history_ext ;INPUT: ;state = the state structure from the themis_w GUI program ;OUTPUT: ;history_ext = a string array that returns the history ;HISTORY: ;13-Nov-2006, jmm, jimm@ssl.berkeley.edu, currently only calls the ; stackmagplot routine, and needs a different mastercdf ; path, ;5-feb-2006, jmm, rewritten, but still only calls the stackmagplot routine ; ;$LastChangedBy: kenb-mac $ ;$LastChangedDate: 2007-01-26 15:52:34 -0800 (Fri, 26 Jan 2007) $ ;$LastChangedRevision: 241 $ ;$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/trunk/idl/themis/common/thm_ui_plot_data.pro $ ; ;- Pro thm_ui_plot_data, state, history_ext @tplot_com ;Put a catch here to insure that the common block is returned in its ;original state err_xxx = 0 catch, err_xxx If(err_xxx Ne 0) Then Begin catch, /cancel message, /info, 'FYI:' help, /last_message, output = err_msg For j = 0, n_elements(err_msg)-1 Do print, err_msg[j] thm_ui_reset_common_block, /restore Return Endif history_ext = '' If(ptr_valid(state.active_vnames)) Then vnames = *state.active_vnames $ Else message, 'Please Load or choose Data' ;Currently only ground magnetometer is available, so check for thg_mag l = strpos(vnames, 'thg_mag') to_plot = where(l Ne -1, nto_plot) If(nto_plot Gt 0) Then Begin tpl_names = tnames() data_ss = where_arr(tpl_names, vnames) ;put the assigned data structure into the tplot common block ;refer to the position in the data_quants array -- use data_ss+1 thm_ui_reset_common_block, data_ss+1 date = time_string(state.st_time) duration = (state.en_time-state.st_time)/86400.0d0 If(state.plot_type Eq 'PNG') Then pngx = 1 Else pngx = 0 thm_gmag_stackplot, date, duration, /no_data_load, $ make_png = pngx, no_expose = pngx thm_ui_reset_common_block, /restore history_ext = ['date = time_string(start_time)', $ 'duration = (end_time-start_time)/86400.0d0', $ 'If(plot_type Eq ''PNG'') Then pngx = 1 Else pngx = 0', $ 'thm_gmag_stackplot, date, duration, /no_data_load, make_png = pngx, no_expose = pngx'] Endif Else message, /info, 'No GMAG data to plot' ;always be sure that you're set to screen plot If(!version.os_family Eq 'Windows') Then set_plot, 'win' $ Else set_plot, 'x' Return End