EFIx_LP_1B (Langmuir probe 2Hz)¶

Abstract: Access to the electric field instrument langmuir probe data (2Hz) (level 1b product).

%load_ext watermark
%watermark -i -v -p viresclient,pandas,xarray,matplotlib
Python implementation: CPython
Python version       : 3.9.7
IPython version      : 8.3.0

viresclient: 0.10.3
pandas     : 1.4.1
xarray     : 0.21.1
matplotlib : 3.5.1
from viresclient import SwarmRequest
import datetime as dt
import matplotlib.pyplot as plt

request = SwarmRequest()

EFIx_LP_1B product information¶

Measurements from the Langmuir Probe (LP) of the Electric Field Instrument (EFI) at 2Hz, for each Swarm spacecraft.

Documentation:

Check what “EFI” data variables are available¶

request.available_collections("EFI", details=False)
{'EFI': ['SW_OPER_EFIA_LP_1B', 'SW_OPER_EFIB_LP_1B', 'SW_OPER_EFIC_LP_1B']}
request.available_measurements("EFI")
['U_orbit',
 'Ne',
 'Ne_error',
 'Te',
 'Te_error',
 'Vs',
 'Vs_error',
 'Flags_LP',
 'Flags_Ne',
 'Flags_Te',
 'Flags_Vs']

Fetch one day of EFI data¶

request.set_collection("SW_OPER_EFIA_LP_1B")
request.set_products(
    measurements=['U_orbit',
                 'Ne',
                 'Ne_error',
                 'Te',
                 'Te_error',
                 'Vs',
                 'Vs_error',
                 'Flags_LP',
                 'Flags_Ne',
                 'Flags_Te',
                 'Flags_Vs']
)
data = request.get_between(
    dt.datetime(2016,1,1),
    dt.datetime(2016,1,2)
)
data.sources
['SW_OPER_EFIA_LP_1B_20160101T000000_20160101T235959_0501_MDR_EFI_LP']

Load and plot using pandas/matplotlib¶

df = data.as_dataframe()
df.head()
Longitude Te Vs Flags_Te Latitude Radius Flags_LP Ne Vs_error Te_error Spacecraft Flags_Ne Flags_Vs Ne_error U_orbit
Timestamp
2016-01-01 00:00:00.196999936 92.799630 2945.20 -2.201 20 -72.511716 6833852.72 1 126188.4 9.999990e+09 9.999990e+09 A 20 20 9.999990e+09 7604.407
2016-01-01 00:00:00.696000000 92.813944 2891.97 -2.193 20 -72.543238 6833853.09 1 127792.9 9.999990e+09 9.999990e+09 A 20 20 9.999990e+09 7604.398
2016-01-01 00:00:01.196999936 92.828370 2921.96 -2.200 20 -72.574886 6833853.91 1 132515.3 9.999990e+09 9.999990e+09 A 20 20 9.999990e+09 7604.389
2016-01-01 00:00:01.696000000 92.842799 2936.74 -2.194 20 -72.606406 6833854.27 1 137933.0 9.999990e+09 9.999990e+09 A 20 20 9.999990e+09 7604.380
2016-01-01 00:00:02.196999936 92.857342 2870.09 -2.190 20 -72.638051 6833855.09 1 138913.8 9.999990e+09 9.999990e+09 A 20 20 9.999990e+09 7604.371
df.plot(y=["Ne", "Te", "Vs"], subplots=True, figsize=(20,5));
../_images/03b__Demo-EFIx_LP_1B_12_0.png
df.plot(x="Latitude", y="Ne");
../_images/03b__Demo-EFIx_LP_1B_13_0.png

Load as xarray¶

ds = data.as_xarray()
ds
<xarray.Dataset>
Dimensions:     (Timestamp: 172776)
Coordinates:
  * Timestamp   (Timestamp) datetime64[ns] 2016-01-01T00:00:00.196999936 ... ...
Data variables: (12/15)
    Spacecraft  (Timestamp) object 'A' 'A' 'A' 'A' 'A' ... 'A' 'A' 'A' 'A' 'A'
    Te          (Timestamp) float64 2.945e+03 2.892e+03 ... 2.527e+03 2.545e+03
    Vs          (Timestamp) float64 -2.201 -2.193 -2.2 ... -2.244 -2.239 -2.243
    Flags_Te    (Timestamp) uint8 20 20 20 20 20 20 20 ... 20 20 20 20 20 20 20
    Latitude    (Timestamp) float64 -72.51 -72.54 -72.57 ... 31.65 31.69 31.72
    Ne          (Timestamp) float64 1.262e+05 1.278e+05 ... 6.485e+04 6.43e+04
    ...          ...
    Radius      (Timestamp) float64 6.834e+06 6.834e+06 ... 6.823e+06 6.823e+06
    Flags_LP    (Timestamp) uint8 1 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1
    Vs_error    (Timestamp) float64 1e+10 1e+10 1e+10 ... 1e+10 1e+10 1e+10
    Te_error    (Timestamp) float64 1e+10 1e+10 1e+10 ... 1e+10 1e+10 1e+10
    Flags_Vs    (Timestamp) uint8 20 20 20 20 20 20 20 ... 20 20 20 20 20 20 20
    U_orbit     (Timestamp) float64 7.604e+03 7.604e+03 ... 7.634e+03 7.634e+03
Attributes:
    Sources:         ['SW_OPER_EFIA_LP_1B_20160101T000000_20160101T235959_050...
    MagneticModels:  []
    RangeFilters:    []
fig, (ax1, ax2) = plt.subplots(figsize=(10, 5), nrows=2, sharex=True)
def subplot(_ax, da):
    """Plot a given DataArray on a given axes"""
    _ax.plot(da)
    _ax.set_ylabel(f"{da.name} [{da.units}]")
for var, ax in zip(("Ne", "Te"), (ax1, ax2)):
    subplot(ax, ds[var])
../_images/03b__Demo-EFIx_LP_1B_16_0.png