pyrfu.pyrf.convert_fac module#

pyrfu.pyrf.convert_fac.convert_fac(inp: DataArray, b_bgd: DataArray, r_xyz: DataArray | ndarray | list | None = None) DataArray[source]#

Transform to a field-aligned coordinate (FAC) system.

The FAC system is defined as :
  • R_parallel_z aligned with the background magnetic field

  • R_perp_y defined by R_parallel cross the position vector of the

    spacecraft (nominally eastward at the equator)

  • R_perp_x defined by R_perp_y cross R_par

If inp is one vector along r direction, out is inp[perp, para] projection.

Parameters:
  • inp (DataArray) – Time series of the input field.

  • b_bgd (DataArray) – Time series of the background magnetic field.

  • r_xyz (xarray.DataArray or ndarray or list) – Position vector of spacecraft.

Returns:

Time series of the input field in field aligned coordinates system.

Return type:

DataArray

Raises:
  • TypeError

    • If inp is not a xarray.DataArray.

    • If b_bgd is not a xarray.DataArray.

    • If r_xyz is not a xarray.DataArray or ndarray or list.

  • ValueError

    • If inp is not a scalar or a vector.

    • If b_bgd is not a vector or a tensor.

    • If r_xyz is not a vector.

Notes

All input parameters must be in the same coordinate system.

Examples

>>> import numpy
>>> from pyrfu import mms, pyrf

Time interval

>>> tint = ["2019-09-14T07:54:00.000", "2019-09-14T08:11:00.000"]

Spacecraft index

>>> mms_id = 1

Load magnetic field (FGM) and electric field (EDP)

>>> b_xyz = mms.get_data("B_gse_fgm_brst_l2", tint, mms_id)
>>> e_xyz = mms.get_data("E_gse_edp_brst_l2", tint, mms_id)

Convert to field aligned coordinates

>>> e_xyzfac = pyrf.convert_fac(e_xyz, b_xyz, numpy.array([1, 0, 0]))