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.0.1

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()
Te Ne_error Spacecraft U_orbit Longitude Te_error Ne Flags_Ne Latitude Vs_error Vs Radius Flags_LP Flags_Vs Flags_Te
Timestamp
2016-01-01 00:00:00.196999936 2945.20 9.999990e+09 A 7604.407 92.799630 9.999990e+09 126188.4 20 -72.511716 9.999990e+09 -2.201 6833852.72 1 20 20
2016-01-01 00:00:00.696000000 2891.97 9.999990e+09 A 7604.398 92.813944 9.999990e+09 127792.9 20 -72.543238 9.999990e+09 -2.193 6833853.09 1 20 20
2016-01-01 00:00:01.196999936 2921.96 9.999990e+09 A 7604.389 92.828370 9.999990e+09 132515.3 20 -72.574886 9.999990e+09 -2.200 6833853.91 1 20 20
2016-01-01 00:00:01.696000000 2936.74 9.999990e+09 A 7604.380 92.842799 9.999990e+09 137933.0 20 -72.606406 9.999990e+09 -2.194 6833854.27 1 20 20
2016-01-01 00:00:02.196999936 2870.09 9.999990e+09 A 7604.371 92.857342 9.999990e+09 138913.8 20 -72.638051 9.999990e+09 -2.190 6833855.09 1 20 20
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'
    Ne_error    (Timestamp) float64 1e+10 1e+10 1e+10 ... 1e+10 1e+10 1e+10
    U_orbit     (Timestamp) float64 7.604e+03 7.604e+03 ... 7.634e+03 7.634e+03
    Te_error    (Timestamp) float64 1e+10 1e+10 1e+10 ... 1e+10 1e+10 1e+10
    Ne          (Timestamp) float64 1.262e+05 1.278e+05 ... 6.485e+04 6.43e+04
    Flags_Ne    (Timestamp) uint8 20 20 20 20 20 20 20 ... 20 20 20 20 20 20 20
    ...          ...
    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
    Te          (Timestamp) float64 2.945e+03 2.892e+03 ... 2.527e+03 2.545e+03
    Longitude   (Timestamp) float64 92.8 92.81 92.83 ... -95.37 -95.37 -95.37
    Flags_Te    (Timestamp) uint8 20 20 20 20 20 20 20 ... 20 20 20 20 20 20 20
    Flags_Vs    (Timestamp) uint8 20 20 20 20 20 20 20 ... 20 20 20 20 20 20 20
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