Skip to content

Commit

Permalink
Merge pull request #24 from nickssl/master
Browse files Browse the repository at this point in the history
Simplified imports
  • Loading branch information
nickssl committed Dec 9, 2023
2 parents 20f9342 + e097f4a commit e2bb203
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions pyspedas_examples/examples/ex_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit e2bb203

Please sign in to comment.