Usage examples

From SPEDAS Wiki
Jump to navigation Jump to search

SPEDAS contains many introductory scripts that you can run and modify in order to learn using IDL and SPEDAS.

MMS data analysis using SPEDAS: an introduction

This video shows a step-by-step introduction on how to use SPEDAS to make a simple plot:

This is the script that can be run in IDL:

Screenshot of example test_mms1

pro test_mms1

 ; Select a time range
 trange = ['2015-09-01/21:15', '2015-09-01/21:25']

 ; Select a probe
 probe = 1

 ; Load FGM data
 mms_load_fgm, probe=probe, trange=trange, level='l2'

 ; Load position data
 mms_load_mec, probe=probe, trange=trange, level='l2'

 ; Select quantities to plot
 vars = ['mms1_fgm_b_gsm_srvy_l2', 'mms1_mec_r_gsm']

 ; Plot data
 tplot, vars


MMS multi-instrument plots

This video shows how to create multi-panel plots with SPEDAS and how to load data from multiple satellite probes:

The scripts in this video are here:

Screenshot of example multiple_plot_test

pro multiple_plot_test

 trange = ['2015-09-01/21:15', '2015-09-01/21:25']
 mms_load_fgm, probes=probes, trange=trange, level='l2'
 mms_load_fpi, probes=probes, trange=trange, level='l2', datatype=['des-moms', 'dis-moms'], data_rate='brst'

 join_vec, 'mms1_des_bulk'+['x', 'y', 'z']+'_dbcs_brst', 'mms1_des_bulk_vel_dbcs'
 join_vec, 'mms1_dis_bulk'+['x', 'y', 'z']+'_dbcs_brst', 'mms1_dis_bulk_vel_dbcs'

 store_data, 'mms1_des_temps_brst', data=['mms1_des_temppara_brst', 'mms1_des_tempperp_brst']
 store_data, 'mms1_dis_temps_brst', data=['mms1_dis_temppara_brst', 'mms1_dis_tempperp_brst']
 store_data, 'mms1_numberdensity_dbcs_brst', data='mms1_d'+['i', 'e']+'s_numberdensity_brst'

 window, 1
 tplot, window=1, title='MMS data - Sept 1, 2015', ['mms1_fgm_b_gsm_srvy_l2', 'mms1_des_bulk_vel_dbcs', 'mms1_des_temps_brst', $
    'mms1_dis_temps_brst', 'mms1_numberdensity_dbcs_brst', 'mms1_des_energyspectr_omni_avg', 'mms1_dis_energyspectr_omni_avg']

 tlimit, trange, window=1

 makepng, "C:\mms\mms_2a", window=1 ; save png file mms_2a.png


Loading and plotting data from multiple probes:

Screenshot of example multiple_plot_test2

pro multiple_plot_test2

 trange = ['2015-09-01/21:15', '2015-09-01/21:25']
 probes = ['1','2','3','4']

 mms_load_fpi, probes=probes, trange=trange, level='l2', datatype=['des-moms'], data_rate='brst'

 window, 1
 tplot, window=1, title='MMS data - Sept 1, 2015', ['mms1_des_energyspectr_omni_brst', $ 
     'mms2_des_energyspectr_omni_brst', 'mms3_des_energyspectr_omni_brst', 'mms4_des_energyspectr_omni_brst']

 tlimit, trange, window=1
 makepng, "C:\mms\mms_2b", window=1  ; save png file mms_2b.png


Themis SST plot

Here is an example script for an SST plot from Themis data:

Screenshot of example Test_themis_sst

pro test_themis_sst

 trange = ['2010-06-05','2010-06-06']

 ;set the date and duration (in days)

 ;set the spacecraft
 probe = 'c'

 ;set the datatype

 datatype = 'psif' ;(psef for electrons, psib/pseb for burst mode, psir/pser for reduced mode)

 ;loads particle data for data type

 ;calculate derived products
 thm_part_products,probe=probe,datatype=datatype,trange=trange,outputs =['energy','theta','phi','moments']

 ;view the loaded data names

 ;plot the energy spectrogram, and angular spectrograms(despun spacecraft coordinates (DSL))

More examples

The source code of SPEDAS contains many code examples and crib sheets. For each mission included in SPEDAS, there is a directory called "examples" that contains code samples. See the directories:

... etc ...