Note
Click here to download the full example code
Importing data¶
A short example showing how to import and plot plasma data.
Out:
Downloading https://cdaweb.gsfc.nasa.gov/pub/data/omni//low_res_omni/omni2_2018.dat to /home/docs/heliopy/data/omni/omni2_2018.dat
0.0% 0 / 2873280
0.3% 8192 / 2873280
0.6% 16384 / 2873280
0.9% 24576 / 2873280
1.1% 32768 / 2873280
1.4% 40960 / 2873280
1.7% 49152 / 2873280
2.0% 57344 / 2873280
2.3% 65536 / 2873280
2.6% 73728 / 2873280
2.9% 81920 / 2873280
3.1% 90112 / 2873280
3.4% 98304 / 2873280
3.7% 106496 / 2873280
4.0% 114688 / 2873280
4.3% 122880 / 2873280
4.6% 131072 / 2873280
4.8% 139264 / 2873280
5.1% 147456 / 2873280
5.4% 155648 / 2873280
5.7% 163840 / 2873280
6.0% 172032 / 2873280
6.3% 180224 / 2873280
6.6% 188416 / 2873280
6.8% 196608 / 2873280
7.1% 204800 / 2873280
7.4% 212992 / 2873280
7.7% 221184 / 2873280
8.0% 229376 / 2873280
8.3% 237568 / 2873280
8.6% 245760 / 2873280
8.8% 253952 / 2873280
9.1% 262144 / 2873280
9.4% 270336 / 2873280
9.7% 278528 / 2873280
10.0% 286720 / 2873280
10.3% 294912 / 2873280
10.5% 303104 / 2873280
10.8% 311296 / 2873280
11.1% 319488 / 2873280
11.4% 327680 / 2873280
11.7% 335872 / 2873280
12.0% 344064 / 2873280
12.3% 352256 / 2873280
12.5% 360448 / 2873280
12.8% 368640 / 2873280
13.1% 376832 / 2873280
13.4% 385024 / 2873280
13.7% 393216 / 2873280
14.0% 401408 / 2873280
14.3% 409600 / 2873280
14.5% 417792 / 2873280
14.8% 425984 / 2873280
15.1% 434176 / 2873280
15.4% 442368 / 2873280
15.7% 450560 / 2873280
16.0% 458752 / 2873280
16.3% 466944 / 2873280
16.5% 475136 / 2873280
16.8% 483328 / 2873280
17.1% 491520 / 2873280
17.4% 499712 / 2873280
17.7% 507904 / 2873280
18.0% 516096 / 2873280
18.2% 524288 / 2873280
18.5% 532480 / 2873280
18.8% 540672 / 2873280
19.1% 548864 / 2873280
19.4% 557056 / 2873280
19.7% 565248 / 2873280
20.0% 573440 / 2873280
20.2% 581632 / 2873280
20.5% 589824 / 2873280
20.8% 598016 / 2873280
21.1% 606208 / 2873280
21.4% 614400 / 2873280
21.7% 622592 / 2873280
22.0% 630784 / 2873280
22.2% 638976 / 2873280
22.5% 647168 / 2873280
22.8% 655360 / 2873280
23.1% 663552 / 2873280
23.4% 671744 / 2873280
23.7% 679936 / 2873280
23.9% 688128 / 2873280
24.2% 696320 / 2873280
24.5% 704512 / 2873280
24.8% 712704 / 2873280
25.1% 720896 / 2873280
25.4% 729088 / 2873280
25.7% 737280 / 2873280
25.9% 745472 / 2873280
26.2% 753664 / 2873280
26.5% 761856 / 2873280
26.8% 770048 / 2873280
27.1% 778240 / 2873280
27.4% 786432 / 2873280
27.7% 794624 / 2873280
27.9% 802816 / 2873280
28.2% 811008 / 2873280
28.5% 819200 / 2873280
28.8% 827392 / 2873280
29.1% 835584 / 2873280
29.4% 843776 / 2873280
29.7% 851968 / 2873280
29.9% 860160 / 2873280
30.2% 868352 / 2873280
30.5% 876544 / 2873280
30.8% 884736 / 2873280
31.1% 892928 / 2873280
31.4% 901120 / 2873280
31.6% 909312 / 2873280
31.9% 917504 / 2873280
32.2% 925696 / 2873280
32.5% 933888 / 2873280
32.8% 942080 / 2873280
33.1% 950272 / 2873280
33.4% 958464 / 2873280
33.6% 966656 / 2873280
33.9% 974848 / 2873280
34.2% 983040 / 2873280
34.5% 991232 / 2873280
34.8% 999424 / 2873280
35.1% 1007616 / 2873280
35.4% 1015808 / 2873280
35.6% 1024000 / 2873280
35.9% 1032192 / 2873280
36.2% 1040384 / 2873280
36.5% 1048576 / 2873280
36.8% 1056768 / 2873280
37.1% 1064960 / 2873280
37.3% 1073152 / 2873280
37.6% 1081344 / 2873280
37.9% 1089536 / 2873280
38.2% 1097728 / 2873280
38.5% 1105920 / 2873280
38.8% 1114112 / 2873280
39.1% 1122304 / 2873280
39.3% 1130496 / 2873280
39.6% 1138688 / 2873280
39.9% 1146880 / 2873280
40.2% 1155072 / 2873280
40.5% 1163264 / 2873280
40.8% 1171456 / 2873280
41.1% 1179648 / 2873280
41.3% 1187840 / 2873280
41.6% 1196032 / 2873280
41.9% 1204224 / 2873280
42.2% 1212416 / 2873280
42.5% 1220608 / 2873280
42.8% 1228800 / 2873280
43.1% 1236992 / 2873280
43.3% 1245184 / 2873280
43.6% 1253376 / 2873280
43.9% 1261568 / 2873280
44.2% 1269760 / 2873280
44.5% 1277952 / 2873280
44.8% 1286144 / 2873280
45.0% 1294336 / 2873280
45.3% 1302528 / 2873280
45.6% 1310720 / 2873280
45.9% 1318912 / 2873280
46.2% 1327104 / 2873280
46.5% 1335296 / 2873280
46.8% 1343488 / 2873280
47.0% 1351680 / 2873280
47.3% 1359872 / 2873280
47.6% 1368064 / 2873280
47.9% 1376256 / 2873280
48.2% 1384448 / 2873280
48.5% 1392640 / 2873280
48.8% 1400832 / 2873280
49.0% 1409024 / 2873280
49.3% 1417216 / 2873280
49.6% 1425408 / 2873280
49.9% 1433600 / 2873280
50.2% 1441792 / 2873280
50.5% 1449984 / 2873280
50.7% 1458176 / 2873280
51.0% 1466368 / 2873280
51.3% 1474560 / 2873280
51.6% 1482752 / 2873280
51.9% 1490944 / 2873280
52.2% 1499136 / 2873280
52.5% 1507328 / 2873280
52.7% 1515520 / 2873280
53.0% 1523712 / 2873280
53.3% 1531904 / 2873280
53.6% 1540096 / 2873280
53.9% 1548288 / 2873280
54.2% 1556480 / 2873280
54.5% 1564672 / 2873280
54.7% 1572864 / 2873280
55.0% 1581056 / 2873280
55.3% 1589248 / 2873280
55.6% 1597440 / 2873280
55.9% 1605632 / 2873280
56.2% 1613824 / 2873280
56.5% 1622016 / 2873280
56.7% 1630208 / 2873280
57.0% 1638400 / 2873280
57.3% 1646592 / 2873280
57.6% 1654784 / 2873280
57.9% 1662976 / 2873280
58.2% 1671168 / 2873280
58.4% 1679360 / 2873280
58.7% 1687552 / 2873280
59.0% 1695744 / 2873280
59.3% 1703936 / 2873280
59.6% 1712128 / 2873280
59.9% 1720320 / 2873280
60.2% 1728512 / 2873280
60.4% 1736704 / 2873280
60.7% 1744896 / 2873280
61.0% 1753088 / 2873280
61.3% 1761280 / 2873280
61.6% 1769472 / 2873280
61.9% 1777664 / 2873280
62.2% 1785856 / 2873280
62.4% 1794048 / 2873280
62.7% 1802240 / 2873280
63.0% 1810432 / 2873280
63.3% 1818624 / 2873280
63.6% 1826816 / 2873280
63.9% 1835008 / 2873280
64.1% 1843200 / 2873280
64.4% 1851392 / 2873280
64.7% 1859584 / 2873280
65.0% 1867776 / 2873280
65.3% 1875968 / 2873280
65.6% 1884160 / 2873280
65.9% 1892352 / 2873280
66.1% 1900544 / 2873280
66.4% 1908736 / 2873280
66.7% 1916928 / 2873280
67.0% 1925120 / 2873280
67.3% 1933312 / 2873280
67.6% 1941504 / 2873280
67.9% 1949696 / 2873280
68.1% 1957888 / 2873280
68.4% 1966080 / 2873280
68.7% 1974272 / 2873280
69.0% 1982464 / 2873280
69.3% 1990656 / 2873280
69.6% 1998848 / 2873280
69.9% 2007040 / 2873280
70.1% 2015232 / 2873280
70.4% 2023424 / 2873280
70.7% 2031616 / 2873280
71.0% 2039808 / 2873280
71.3% 2048000 / 2873280
71.6% 2056192 / 2873280
71.8% 2064384 / 2873280
72.1% 2072576 / 2873280
72.4% 2080768 / 2873280
72.7% 2088960 / 2873280
73.0% 2097152 / 2873280
73.3% 2105344 / 2873280
73.6% 2113536 / 2873280
73.8% 2121728 / 2873280
74.1% 2129920 / 2873280
74.4% 2138112 / 2873280
74.7% 2146304 / 2873280
75.0% 2154496 / 2873280
75.3% 2162688 / 2873280
75.6% 2170880 / 2873280
75.8% 2179072 / 2873280
76.1% 2187264 / 2873280
76.4% 2195456 / 2873280
76.7% 2203648 / 2873280
77.0% 2211840 / 2873280
77.3% 2220032 / 2873280
77.5% 2228224 / 2873280
77.8% 2236416 / 2873280
78.1% 2244608 / 2873280
78.4% 2252800 / 2873280
78.7% 2260992 / 2873280
79.0% 2269184 / 2873280
79.3% 2277376 / 2873280
79.5% 2285568 / 2873280
79.8% 2293760 / 2873280
80.1% 2301952 / 2873280
80.4% 2310144 / 2873280
80.7% 2318336 / 2873280
81.0% 2326528 / 2873280
81.3% 2334720 / 2873280
81.5% 2342912 / 2873280
81.8% 2351104 / 2873280
82.1% 2359296 / 2873280
82.4% 2367488 / 2873280
82.7% 2375680 / 2873280
83.0% 2383872 / 2873280
83.3% 2392064 / 2873280
83.5% 2400256 / 2873280
83.8% 2408448 / 2873280
84.1% 2416640 / 2873280
84.4% 2424832 / 2873280
84.7% 2433024 / 2873280
85.0% 2441216 / 2873280
85.2% 2449408 / 2873280
85.5% 2457600 / 2873280
85.8% 2465792 / 2873280
86.1% 2473984 / 2873280
86.4% 2482176 / 2873280
86.7% 2490368 / 2873280
87.0% 2498560 / 2873280
87.2% 2506752 / 2873280
87.5% 2514944 / 2873280
87.8% 2523136 / 2873280
88.1% 2531328 / 2873280
88.4% 2539520 / 2873280
88.7% 2547712 / 2873280
89.0% 2555904 / 2873280
89.2% 2564096 / 2873280
89.5% 2572288 / 2873280
89.8% 2580480 / 2873280
90.1% 2588672 / 2873280
90.4% 2596864 / 2873280
90.7% 2605056 / 2873280
90.9% 2613248 / 2873280
91.2% 2621440 / 2873280
91.5% 2629632 / 2873280
91.8% 2637824 / 2873280
92.1% 2646016 / 2873280
92.4% 2654208 / 2873280
92.7% 2662400 / 2873280
92.9% 2670592 / 2873280
93.2% 2678784 / 2873280
93.5% 2686976 / 2873280
93.8% 2695168 / 2873280
94.1% 2703360 / 2873280
94.4% 2711552 / 2873280
94.7% 2719744 / 2873280
94.9% 2727936 / 2873280
95.2% 2736128 / 2873280
95.5% 2744320 / 2873280
95.8% 2752512 / 2873280
96.1% 2760704 / 2873280
96.4% 2768896 / 2873280
96.7% 2777088 / 2873280
96.9% 2785280 / 2873280
97.2% 2793472 / 2873280
97.5% 2801664 / 2873280
97.8% 2809856 / 2873280
98.1% 2818048 / 2873280
98.4% 2826240 / 2873280
98.6% 2834432 / 2873280
98.9% 2842624 / 2873280
99.2% 2850816 / 2873280
99.5% 2859008 / 2873280
99.8% 2867200 / 2873280
100.0% 2875392 / 2873280
/home/docs/checkouts/readthedocs.org/user_builds/heliopy/envs/0.11.1/lib/python3.7/site-packages/sunpy/timeseries/timeseriesbase.py:126: SunpyUserWarning: Using .data to access the dataframe is discouraged; use .to_dataframe() instead.
"use .to_dataframe() instead.", SunpyUserWarning)
Index(['Bartels Rotation Number', 'ID IMF Spacecraft',
'ID SW Plasma Spacecraft', 'points(IMF Average)',
'points(Plasma Average)', '|B|', 'Magnitude of Avg Field Vector',
'Lat. Angle of Aver. Field Vector', 'Long. Angle of Aver. Field Vector',
'Bx GSE, GSM', 'By GSE', 'Bz GSE', 'By GSM', 'Bz GSM', 'sigma |B|',
'sigma B', 'sigma Bx', 'sigma By', 'sigma Bz', 'Proton Temperature',
'Proton Density', 'Plasma Flow Speed', 'Plasma Flow Long. Angle',
'Plasma Flow Lat. Angle', 'Na/Np', 'Flow Pressure', 'sigma T',
'sigma N', 'sigma V', 'sigma phi V', 'sigma theta V', 'sigma Na/Np',
'Electric Field', 'Plasma Beta', 'Alfven Mach Number', 'Kp', 'R',
'DST Index', 'AE Index', 'Proton Flux > 1MeV', 'Proton Flux > 2MeV',
'Proton Flux > 4MeV', 'Proton Flux > 10MeV', 'Proton Flux > 30MeV',
'Proton Flux > 60MeV', 'flag', 'ap index', 'f10.7 index', 'PC(N) index',
'AL index (Kyoto)', 'AU index (Kyoto)', 'Magnetosonic Mach No.'],
dtype='object')
from datetime import datetime, timedelta
import heliopy.data.omni as omni
import matplotlib.pyplot as plt
starttime = datetime(2018, 12, 1)
endtime = starttime + timedelta(days=30)
tseries = omni.low(starttime, endtime)
print(tseries.data.keys())
fig, axs = plt.subplots(3, 1, sharex=True)
ax = axs[0]
ax.plot(tseries.index, tseries.quantity("Plasma Flow Speed"),
label="$v_{sw}$")
ax = axs[1]
ax.plot(tseries.index, tseries.quantity("|B|"),
label="$|B|$")
ax = axs[2]
ax.plot(tseries.index, tseries.quantity("Proton Density"),
label="$n_p$")
for ax in axs:
ax.legend()
plt.show()
Total running time of the script: ( 0 minutes 1.277 seconds)