pyrfu.mms.dsl2gsm#

pyrfu.mms.dsl2gsm(inp: DataArray, defatt: Dataset | ndarray, direction: int | None = 1) → DataArray[source]#

Transform time series from MMS’s DSL to GSM.

Parameters:
  • inp (DataArray) – Input time series to convert.

  • defatt (Dataset or numpy.ndarray) – Spacecraft attitude (DEFATT), or the spin axis in GSM as a 3-vector (normalised internally).

  • direction ({1, -1}, Optional) – Direction of transformation. +1 DSL -> GSE, -1 GSE -> DSL. Default is 1.

Returns:

Time series of the input field in the new coordinates systems. COORDINATE_SYSTEM is set to “GSM” (direction 1) or “DSL” (direction -1).

Return type:

DataArray

Raises:

TypeError – If defatt is not xarray.Dataset or numpy.ndarray.

Examples

>>> from pyrfu.mms import get_data, load_ancillary, dsl2gse

Define time interval

>>> tint = ["2015-05-09T14:00:000", "2015-05-09T17:59:590"]

Load magnetic field in spacecraft coordinates

>>> b_xyz = get_data("b_dmpa_fgm_brst_l2", tint, 1)

Load spacecraft attitude

>>> defatt = load_ancillary("defatt", tint, 1)

Transform magnetic field to GSM coordinates

>>> b_gsm = dsl2gsm(b_xyz, defatt)