pyrfu.pyrf.cotrans#
- pyrfu.pyrf.cotrans(inp, flag, hapgood: bool = True)[source]#
Coordinate transformation GE0/GEI/GSE/GSM/SM/MAG as described in [1]
- Parameters:
inp (xarray.DataArray) – Time series of the input field.
flag (str) – Coordinates transformation “{coord1}>{coord2}”, where coord1 and coord2 can be geo/gei/gse/gsm/sm/mag (case-insensitive). If only “{coord2}” is given, coord1 is read from the COORDINATE_SYSTEM attribute of inp. “dipoledirectiongse” returns the dipole direction in GSE at the times of inp.
hapgood (bool, Optional) – Indicator if original Hapgood sources should be used for angle computations or if updated USNO-AA sources should be used. Default = true, meaning original Hapgood sources.
- Returns:
out – Time series of the field in coord2. If inp is a scalar time series, the transformation matrices.
- Return type:
- Raises:
ValueError – If the input frame is neither in flag nor in the COORDINATE_SYSTEM attribute of inp, if they differ, or if the transformation is unknown.
Notes
With hapgood=False, the Greenwich mean sidereal time is computed from UT, as the USNO formula requires. irfu-matlab computes it from TT, which rotates GEO by 0.29 deg about the z-axis, so the transformations between GEO or MAG and GEI, GSE, GSM or SM differ from irfu-matlab by up to 0.29 deg. The dipole direction (used for GSM and SM) is always computed with the Hapgood sidereal time.
Examples
>>> from pyrfu.mms import get_data >>> from pyrfu.pyrf import cotrans
Time interval
>>> tint = ["2019-09-14T07:54:00.000", "2019-09-14T08:11:00.000"]
Spacecraft index
>>> mms_id = 1
Load magnetic field in GSE coordinates
>>> b_gse = get_data("b_gse_fgm_srvy_l2", tint, mms_id)
Transform to GSM assuming that the original coordinates system is part of the inp metadata
>>> b_gsm = cotrans(b_gse, 'GSM')
If the original coordinates is not in the meta
>>> b_gsm = cotrans(b_gse, 'GSE>GSM')
Compute the dipole direction in GSE
>>> dipole = cotrans(b_gse.time, 'dipoledirectiongse')
References
[1]Hapgood 1997 (corrected version of Hapgood 1992) Planet.Space Sci..Vol. 40, No. 5. pp. 71l - 717, 1992