Parker Solar Probe peihelion 1

This example shows how to plot magnetic field data from the first perihelion pass of Parker Solar Probe. Not shown here (because the files are quite large!) are the particle properties measured by SWEAP, which can be accessed with heliopy.data.psp.sweap_spc_l3.

Import the required packages

from heliopy.data import psp
from datetime import datetime
import matplotlib.pyplot as plt

Define the starttime and endtime of the perihelion pass

starttime = datetime(2018, 11, 2)
endtime = datetime(2018, 11, 10)

Download and load the magnetic field data

mag = psp.fields_mag_rtn_1min(starttime, endtime)

Out:

Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181102_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181102_v01.cdf

  0.0%     0 / 91284
  9.0%  8192 / 91284
 17.9% 16384 / 91284
 26.9% 24576 / 91284
 35.9% 32768 / 91284
 44.9% 40960 / 91284
 53.8% 49152 / 91284
 62.8% 57344 / 91284
 71.8% 65536 / 91284
 80.8% 73728 / 91284
 89.7% 81920 / 91284
 98.7% 90112 / 91284
100.0% 98304 / 91284


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181103_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181103_v01.cdf

  0.0%     0 / 91502
  9.0%  8192 / 91502
 17.9% 16384 / 91502
 26.9% 24576 / 91502
 35.8% 32768 / 91502
 44.8% 40960 / 91502
 53.7% 49152 / 91502
 62.7% 57344 / 91502
 71.6% 65536 / 91502
 80.6% 73728 / 91502
 89.5% 81920 / 91502
 98.5% 90112 / 91502
100.0% 98304 / 91502


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181104_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181104_v01.cdf

  0.0%     0 / 91770
  8.9%  8192 / 91770
 17.9% 16384 / 91770
 26.8% 24576 / 91770
 35.7% 32768 / 91770
 44.6% 40960 / 91770
 53.6% 49152 / 91770
 62.5% 57344 / 91770
 71.4% 65536 / 91770
 80.3% 73728 / 91770
 89.3% 81920 / 91770
 98.2% 90112 / 91770
100.0% 98304 / 91770


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181105_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181105_v01.cdf

  0.0%     0 / 89026
  9.2%  8192 / 89026
 18.4% 16384 / 89026
 27.6% 24576 / 89026
 36.8% 32768 / 89026
 46.0% 40960 / 89026
 55.2% 49152 / 89026
 64.4% 57344 / 89026
 73.6% 65536 / 89026
 82.8% 73728 / 89026
 92.0% 81920 / 89026
100.0% 90112 / 89026


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181106_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181106_v01.cdf

  0.0%     0 / 84754
  9.7%  8192 / 84754
 19.3% 16384 / 84754
 29.0% 24576 / 84754
 38.7% 32768 / 84754
 48.3% 40960 / 84754
 58.0% 49152 / 84754
 67.7% 57344 / 84754
 77.3% 65536 / 84754
 87.0% 73728 / 84754
 96.7% 81920 / 84754
100.0% 90112 / 84754


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181107_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181107_v01.cdf

  0.0%     0 / 87462
  9.4%  8192 / 87462
 18.7% 16384 / 87462
 28.1% 24576 / 87462
 37.5% 32768 / 87462
 46.8% 40960 / 87462
 56.2% 49152 / 87462
 65.6% 57344 / 87462
 74.9% 65536 / 87462
 84.3% 73728 / 87462
 93.7% 81920 / 87462
100.0% 90112 / 87462


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181108_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181108_v01.cdf

  0.0%     0 / 91936
  8.9%  8192 / 91936
 17.8% 16384 / 91936
 26.7% 24576 / 91936
 35.6% 32768 / 91936
 44.6% 40960 / 91936
 53.5% 49152 / 91936
 62.4% 57344 / 91936
 71.3% 65536 / 91936
 80.2% 73728 / 91936
 89.1% 81920 / 91936
 98.0% 90112 / 91936
100.0% 98304 / 91936


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181109_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181109_v01.cdf

  0.0%     0 / 89579
  9.1%  8192 / 89579
 18.3% 16384 / 89579
 27.4% 24576 / 89579
 36.6% 32768 / 89579
 45.7% 40960 / 89579
 54.9% 49152 / 89579
 64.0% 57344 / 89579
 73.2% 65536 / 89579
 82.3% 73728 / 89579
 91.5% 81920 / 89579
100.0% 90112 / 89579


Downloading https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181110_v01.cdf to /home/docs/heliopy/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_20181110_v01.cdf

  0.0%     0 / 87219
  9.4%  8192 / 87219
 18.8% 16384 / 87219
 28.2% 24576 / 87219
 37.6% 32768 / 87219
 47.0% 40960 / 87219
 56.4% 49152 / 87219
 65.7% 57344 / 87219
 75.1% 65536 / 87219
 84.5% 73728 / 87219
 93.9% 81920 / 87219
100.0% 90112 / 87219

Plot the data!

fig, ax = plt.subplots(figsize=(10, 4))

for comp, label in enumerate(['Br', 'Bt', 'Bn']):
    ax.plot(mag.index, mag.quantity(f'psp_fld_l2_mag_RTN_1min_{comp}'),
            linewidth=1, zorder=-comp, label=label)

ax.legend()
ax.set_ylabel('nT')
ax.set_title('PSP Perihelion 1')
fig.autofmt_xdate()
plt.show()
PSP Perihelion 1

Total running time of the script: ( 0 minutes 3.266 seconds)

Gallery generated by Sphinx-Gallery