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.11.6
IPython version      : 8.18.0

viresclient: 0.12.0
pandas     : 2.1.3
xarray     : 2023.12.0
matplotlib : 3.8.2
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',
  'SW_FAST_EFIA_LP_1B',
  'SW_FAST_EFIB_LP_1B',
  'SW_FAST_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_0602_MDR_EFI_LP']

Load and plot using pandas/matplotlib#

df = data.as_dataframe()
df.head()
Longitude Radius Ne_error Te_error Vs Flags_LP Flags_Te Flags_Vs Latitude Ne Te Spacecraft Vs_error U_orbit Flags_Ne
Timestamp
2016-01-01 00:00:00.196999936 92.799630 6833853.41 28365.234486 -245.895850 -2.201 1 10 20 -72.511716 126188.4 2945.204213 A 9.999990e+09 7604.407 10
2016-01-01 00:00:00.696000000 92.813943 6833854.00 28725.923124 -259.711123 -2.193 1 10 20 -72.543238 127792.9 2891.969742 A 9.999990e+09 7604.397 10
2016-01-01 00:00:01.196999936 92.828370 6833854.59 29787.432673 -247.826218 -2.200 1 10 20 -72.574886 132515.3 2921.955198 A 9.999990e+09 7604.388 10
2016-01-01 00:00:01.696000000 92.842799 6833855.18 31005.243307 -239.714158 -2.194 1 10 20 -72.606406 137933.0 2936.736557 A 9.999990e+09 7604.379 10
2016-01-01 00:00:02.196999936 92.857342 6833855.77 31225.718904 -257.759606 -2.190 1 10 20 -72.638051 138913.8 2870.090847 A 9.999990e+09 7604.370 10
df.plot(y=["Ne", "Te", "Vs"], subplots=True, figsize=(20,5));
../_images/95060b2ecd6ad2d7afb7798110d03ac944c07120b0731c90bd16889d67eaedb9.png
df.plot(x="Latitude", y="Ne");
../_images/41151fa9805db9dabc7d670bdb649e9e5ca4b88990468d2a4ad9c77320a6091b.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'
    Longitude   (Timestamp) float64 92.8 92.81 92.83 ... -95.37 -95.37 -95.37
    Radius      (Timestamp) float64 6.834e+06 6.834e+06 ... 6.823e+06 6.823e+06
    Te_error    (Timestamp) float64 -245.9 -259.7 -247.8 ... -408.5 -403.6
    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
    Latitude    (Timestamp) float64 -72.51 -72.54 -72.57 ... 31.65 31.69 31.72
    ...          ...
    Ne_error    (Timestamp) float64 2.837e+04 2.873e+04 ... 1.458e+04 1.445e+04
    Vs          (Timestamp) float64 -2.201 -2.193 -2.2 ... -2.244 -2.239 -2.243
    Flags_Te    (Timestamp) uint8 10 10 10 10 10 10 10 ... 10 10 10 10 10 10 10
    Flags_Vs    (Timestamp) uint8 20 20 20 20 20 20 20 ... 20 20 20 20 20 20 20
    Vs_error    (Timestamp) float64 1e+10 1e+10 1e+10 ... 1e+10 1e+10 1e+10
    Flags_Ne    (Timestamp) uint8 10 10 10 10 10 10 10 ... 10 10 10 10 10 10 10
Attributes:
    Sources:         ['SW_OPER_EFIA_LP_1B_20160101T000000_20160101T235959_060...
    MagneticModels:  []
    AppliedFilters:  []
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/b8aa66cc0fe7a7e31e3440e9ead232536ca0ec686ccb28c6aaf7fe5036ecbdd5.png