diff --git a/pyspedas_examples/examples/ex_spectra.py b/pyspedas_examples/examples/ex_spectra.py index 6adf020..be1123c 100644 --- a/pyspedas_examples/examples/ex_spectra.py +++ b/pyspedas_examples/examples/ex_spectra.py @@ -6,35 +6,34 @@ """ -import pyspedas -import pytplot +from pytplot import del_data, options, tplot_options, ylim, tplot +from pyspedas.themis import state, sst def ex_spectra(plot=True): """Download THEMIS data and create a plot.""" # Delete any existing pytplot variables - pytplot.del_data() + del_data() # Download THEMIS data for 2015-12-31 - # pyspedas.load_data('themis', ['2015-12-31'], ['tha'], 'state', 'l1') - # pyspedas.load_data('themis', ['2015-12-31'], ['tha'], 'sst', 'l2') time_range = ['2015-12-31 00:00:00', '2015-12-31 23:59:59'] - pyspedas.themis.state(probe='a', trange=time_range) - pyspedas.themis.sst(probe='a', trange=time_range, - varnames=['tha_psif_en_eflux']) + state(probe='a', trange=time_range) + sst(probe='a', trange=time_range, varnames=['tha_psif_en_eflux']) # Specify options - pytplot.ylim('tha_pos', -23000.0, 81000.0) - pytplot.ylim('tha_psif_en_eflux', 10000.0, 4000000.0) - pytplot.options('tha_psif_en_eflux', 'colormap', 'jet') - pytplot.tplot_options('title', 'tha 2015-12-31') + ylim('tha_pos', -23000.0, 81000.0) + ylim('tha_psif_en_eflux', 10000.0, 4000000.0) + options('tha_psif_en_eflux', 'colormap', 'jet') + tplot_options('title', 'tha 2015-12-31') # Plot line and spectrogram if plot: - pytplot.tplot(['tha_pos', 'tha_psif_en_eflux']) + tplot(['tha_pos', 'tha_psif_en_eflux']) # Return 1 as indication that the example finished without problems. return 1 + # Run the example code -# ex_spectra() +if __name__ == '__main__': + ex_spectra()