示例#1
0
文件: omni.py 项目: zemarchezi/gmag
def load(sdate,
         edate,
         var=[
             'Bx GSE, GSM', 'By GSM', 'Bz GSM', 'Proton Density',
             'Plasma Flow Speed', 'Flow Pressure', 'Kp', 'DST Index',
             'AE Index', 'f10.7 index'
         ]):

    sdate = pd.to_datetime(sdate)
    edate = pd.to_datetime(edate)

    o_dat = omni.low(sdate, edate)

    if var is not None:
        o_dat = o_dat.data[var]
    else:
        o_dat = o_dat.data

    c_df = clean(o_dat.copy())
    c_df.columns = c_df.columns.str.replace(',', '')
    c_df.columns = c_df.columns.str.replace('.', '')
    c_df.columns = c_df.columns.str.replace(' ', '_')

    return c_df
示例#2
0
 def test_mag(self):
     df = omni.low(self.starttime, self.endtime)
     check_data_output(df)
示例#3
0
# ---
# The ``heliopy.data`` module can be used to download and import a wide range of in situ datasets from various heliospheric missions. In this example we use data from OMNI, which provides measurements of the solar wind at the orbit of the Earth.

# In[6]:


from heliopy.data import omni
from datetime import datetime


# In[7]:


starttime = datetime(2018, 10, 1)
endtime = datetime(2018, 12, 1)
data = omni.low(starttime, endtime)


# The data is stored in the ``data`` object. We can print the available columns in this object:

# In[8]:


for col in data.columns:
    print(col)


# Plotting in-situ data
# ---
# Matplotlib can be used to plot the downloaded data. In this example we plot the solar wind speed and the magnetic field clock angle, to see different polarity solar wind streams.
# 
示例#4
0
"""
Importing data
==============

A short example showing how to import and plot plasma data.
"""

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$")