Example #1
0
def test_solo(descriptor):
    with pytest.warns(
            UserWarning,
            match='Low latency data is not suitable for publication'):
        df = solo.download(starttime, endtime, descriptor, 'LL02')
    check_data_output(df)
Example #2
0
def test_solo_bad_descriptor():
    with pytest.raises(RuntimeError,
                       match='No data files found for descriptor=GARBAGE'):
        df = solo.download(starttime, endtime, 'garbage', 'LL02')
from astropy.time import Time
from heliopy.data.solo import download
import plasmapy.formulary
from sunpy.timeseries import GenericTimeSeries

###############################################################################
# Set some nice default plotting settings
from astropy.visualization import quantity_support
quantity_support()
matplotlib.rcParams['date.converter'] = 'concise'

###############################################################################
# Get 12 hours day of MAG data in normal mode.
start_time = "2020-07-07 12:00:00"
end_time = "2020-07-08 00:00:00"
mag_data = download(start_time, end_time, 'MAG-RTN-NORMAL', 'L2')
print(mag_data.columns)

###############################################################################
# Get 12 hours of SWA/PAS ground moments.
swa_data = download(start_time, end_time, 'SWA-PAS-GRND-MOM', 'L2')
print(swa_data.columns)

###############################################################################
# Re-index the magnetic field data on to the plasma data timestamps.
# To do this the magnetic field `~sunpy.timeseries.GenericTimeSeries` is first
# converted to a `~pandas.DataFrame`, so the powerful time-series maniuplation
# tools present in `pandas` can be used. Then the data is re-indexed using
# a nearest neighbour method, and re-inserted into a
# `~sunpy.timeseries.GenericTimeSeries` to preserve the unit information
mag_df = mag_data.to_dataframe()
Example #4
0
###############################################################################
# Import the required modules
from datetime import datetime
import warnings

import astropy.units as u
import matplotlib.pyplot as plt
from matplotlib import dates as mdates
import numpy as np

from heliopy.data.solo import download

###############################################################################
# Download some magnetic field data

data = download(datetime(2020, 7, 10), datetime(2020, 8, 3), 'MAG', 'LL02')
print(data.columns)

###############################################################################
# Calculate the magnetic field mangitude
modB = np.sqrt(
    data.quantity('B_RTN_0')**2 + data.quantity('B_RTN_1')**2 +
    data.quantity('B_RTN_2')**2)
data = data.add_column('modB', modB)

###############################################################################
# Plot the data
fig, axs = plt.subplots(nrows=2, sharex=True)

ax = axs[0]
ax.plot(data.index, data.quantity('modB'))
Example #5
0
"""

###############################################################################
# Import the required modules
from datetime import datetime

import matplotlib.pyplot as plt
from matplotlib import dates as mdates
import numpy as np

from heliopy.data.solo import download

###############################################################################
# Download some magnetic field data

data = download(datetime(2020, 6, 2), datetime(2020, 6, 3), 'MAG-RTN-NORMAL',
                'L2')
print(data.columns)

###############################################################################
# Calculate the magnetic field mangitude
modB = np.sqrt(
    data.quantity('B_RTN_0')**2 + data.quantity('B_RTN_1')**2 +
    data.quantity('B_RTN_2')**2)
data = data.add_column('modB', modB)

###############################################################################
# Plot the data
fig, axs = plt.subplots(nrows=2, sharex=True)

ax = axs[0]
ax.plot(data.index, data.quantity('modB'))
Example #6
0
def test_solo_science():
    starttime = datetime(2020, 6, 2)
    endtime = datetime(2020, 6, 2, 12)
    df = solo.download(starttime, endtime, 'MAG-RTN-NORMAL', 'L2')
    check_data_output(df)
Example #7
0
def test_solo_science(descriptor):
    starttime = datetime(2020, 9, 1)
    endtime = datetime(2020, 9, 1, 12)
    df = solo.download(starttime, endtime, descriptor, 'L2')
    check_data_output(df)