Coordinate Systems
PySPEDAS can transform between many of the standard coordinate systems used in heliophysics:
GSE (Geocentric Solar Ecliptic)
GSM (Geocentric Solar Magnetic)
GEI (Geocentric Equatorial Inertial)
SM (Solar Magnetic)
GEO (Geographic)
J2000
There are also routines for working with other specialized coordinate systems
FAC (Field alignned coordinates)
LMN (Boundary-normal coordinates)
MVA (Minimum-variance coordinates)
Some individual projects may include additional coordinate trasformation routines for systems used by those missions. Documentation for the mission-specific coordinate transform tools and other utilities can be found on the “Mission Specific Tools” page.
Transformations
- pyspedas.cotrans(name_in=None, name_out=None, time_in=None, data_in=None, coord_in=None, coord_out=None)[source]
Transform data from coord_in to coord_out.
- Parameters:
name_in (
str, optional) – Tplot name for input data.name_out (
str, optional) – Tplot name for output data.time_in (
listoffloat, optional) – Time array. Ignored if name_in is provided.data_in (
listoffloat, optional) – Data in the coord_in system. Ignored if name_in is provided.coord_in (
str) – Name of input coordinate system. Valid options: “gse”, “gsm”, “sm”, “gei”, “geo”, “mag”, “j2000”coord_out (
str) – Name of output coordinate system. Valid options: “gse”, “gsm”, “sm”, “gei”, “geo”, “mag”, “j2000”
- Returns:
Returns 1 for successful completion,0 for error.– Fills a new tplot variable with data in the coord_out system.np.array– If name_in and name_out are not provided, returns the transformed data array.
Examples
import pyspedas
pyspedas.projects.themis.state(trange=['2015-10-16', '2015-10-17'], probe='c')
from pyspedas import cotrans
cotrans(name_in='thc_pos_gse', name_out='gsm_data', coord_in='gse', coord_out='gsm')
cotrans(name_in='thc_pos_gse', name_out='sm_data', coord_in='gse', coord_out='sm')
cotrans(name_in='thc_pos_gse', name_out='geo_data', coord_in='gse', coord_out='geo')
from pyspedas import tplot
tplot(['gsm_data', 'sm_data', 'geo_data'])
Cartesian to Spherical Coordinates
- pyspedas.cart2spc(x, y, z)[source]
Convert Cartesian coordinates to spherical coordinates.
Parameters:
- xfloat
X coordinate in Cartesian system.
- yfloat
Y coordinate in Cartesian system.
- zfloat
Z coordinate in Cartesian system.
Returns:
- rfloat
Radial distance from the origin.
- thetafloat
Polar angle (angle from the positive z-axis to the point) in radians. It ranges from [0, pi].
- phifloat
Azimuthal angle (angle in the xy-plane from the positive x-axis to the point) in radians. It ranges from [0, 2*pi].
Notes:
- Uses the following equations for conversion:
r = sqrt(x^2 + y^2 + z^2) theta = arccos(z/r) phi = 2*pi - arccos(x/sqrt(x^2 + y^2)) if y < 0, otherwise arccos(x/sqrt(x^2 + y^2))
- pyspedas.cart_to_sphere(x, y, z)[source]
Convert Cartesian coordinates to spherical coordinates.
Parameters:
- xfloat
X coordinate in Cartesian system.
- yfloat
Y coordinate in Cartesian system.
- zfloat
Z coordinate in Cartesian system.
Returns:
- rfloat
Radial distance from the origin.
- thetafloat
Altitude angle (not co-latitude!) from XY plane to point, in degrees. It ranges from -90 to 90 degrees
- phifloat
Azimuthal angle (angle in the xy-plane from the positive x-axis to the point) in radians. It ranges from 0 to 360 degrees.
Notes:
- Uses the following equations for conversion:
r = sqrt(x^2 + y^2 + z^2) theta = arcsin(z/r) phi = 2*pi - arccos(x/sqrt(x^2 + y^2)) if y < 0, otherwise arccos(x/sqrt(x^2 + y^2))
- pyspedas.xyz_to_polar(data, co_latitude=False)[source]
Convert cartesian coordinates to polar coordinates.
- Parameters:
x (
numpy.ndarray) – x-component of the vectory (
numpy.ndarray) – y-component of the vectorz (
numpy.ndarray) – z-component of the vector
- Returns:
r (
numpy.ndarray) – radial component of the vectortheta (
numpy.ndarray) – polar angle of the vectorphi (
numpy.ndarray) – azimuthal angle of the vector
Spherical to Cartesian Coordinates
- pyspedas.spc2cart(r, theta, phi)[source]
Convert spherical coordinates (r, theta, phi) to Cartesian coordinates (x, y, z).
Parameters:
- rfloat
Radial distance from the origin.
- thetafloat
Polar angle (angle from the positive z-axis to the point) in radians. It ranges from [0, pi].
- phifloat
Azimuthal angle (angle in the xy-plane from the positive x-axis to the point) in radians. It ranges from [0, 2*pi].
Returns:
- xfloat
X coordinate in Cartesian system.
- yfloat
Y coordinate in Cartesian system.
- zfloat
Z coordinate in Cartesian system.
Notes:
- Uses the following equations for conversion:
x = r*sin(theta)*cos(phi) y = r*sin(theta)*sin(phi) z = r*cos(theta)
- pyspedas.sphere_to_cart(r, theta, phi)[source]
Convert spherical coordinates in degrees (r, theta, phi) to Cartesian coordinates (x, y, z).
Parameters:
- rfloat
Radial distance from the origin.
- thetafloat
Altitude angle (not co-latitude!) It ranges from -90 to 90 degrees
- phifloat
Azimuthal angle (angle in the xy-plane from the positive x-axis to the point) in degrees. It ranges from [0, 360].
Returns:
- xfloat
X coordinate in Cartesian system.
- yfloat
Y coordinate in Cartesian system.
- zfloat
Z coordinate in Cartesian system.
Notes:
- Uses the following equations for conversion:
x = r*cos(theta)*cos(phi) y = r*cos(theta)*sin(phi) z = r*sin(theta)
Field-Aligned Coordinates (FAC)
In this coordinate system, the Z axis is aligned with the magnetic field direction. This leaves a degree of freedom for the orientation of the X and Y axes. The “other_dim” parameter lets the user select a reference direction from a number of options (some of which require an additional input variable to specify the probe position). The output is a set of rotation matrices versus time, suitable for use with the tvector_rotate utility.
- pyspedas.fac_matrix_make(mag_var_name, other_dim='Xgse', pos_var_name=None, newname=None)[source]
Generate a field-aligned coordinate (FAC) transformation matrix from the given magnetic field B and (if required) position data, and store it in a tplot variable.
- Parameters:
mag_var_name (
str) – tplot variable containing the magnetic field data.other_dim (
str, optional) – The coordinate system option. Must be one of: [‘xgse’,’rgeo’,’phigeo’, ‘mrgeo’,’mphigeo’,’phism’,’mphism’,’ygsm’,’zdsl’]. (Default is “xgse”.)pos_var_name (
str, optional) – tplot variable containing the spacecraft position data. Required for all options except “xgse” (and “zdsl”, in development).newname (
str, optional) – Name of the output tplot variable. Defaults to mag_var_name + “_fac_mat”.
- Returns:
The name of the output tplot variable containing the FAC matrix, or None if an error occurs.
- Return type:
Minimum Variance (MVA) Coordinates
In this coordinate system, a set of right-handed basis vectors i,j,k representing the maximum, intermediate, and minimum variance directions is produced from an input variable, using a sliding window for the variance, eigenvalue, and eigenvector calculations. To resolve ambiguity in the direction of the basis vectors (i, j, and k), the signs are manipulated such that the Z components in the j and k directions are positive, and the signs of the i components are chosen so that (i,j,k) form a right-handed coordinate system. The output is a set of rotation matrices over time, suitable for use with the tvector_rotate utility.
Minimum Variance Analysis shares several similarities with Principal Component Analysis (PCA): both approaches involve setting up a covariance matrix, and finding eigenvalues and eigenvectors to form an orthnormal coordinate system. However, there are some key differences:
* PySPEDAS' MVA tools work with time-verying 3-d vector data, while PCA is often applied to high-dimensional data sets.
* MVA preserves the absolute variance and basis vector directions, while PCA often renormalizes its inputs to have mean 0 and variance 1.
* MVA uses a sliding time window, while PCA is usually applied to the entire dataset at once.
* PCA is often used to reduce the dimensionality of the data set, while MVA keeps all three dimensions
* PCA is more concerned with the amount of variance that is explained by each dimension, while in MVA, the output basis vectors are the output of most interest.
- pyspedas.minvar_matrix_make(in_var_name, tstart=None, tstop=None, twindow=None, tslide=None, newname=None, evname=None, tminname=None, tmidname=None, tmaxname=None)[source]
Use an input variable to make rotation matrices to rotate vectors into a minimum variance coordinate system.
- Parameters:
in_var_name (
str) – Name of the input variable that defines the coordinate systemtstart (
str) – Start time of the interval for which MVA matrices will be created.tend (
str) – End time of the interval for which MVA matrices will be created.twindow (
float) – Duration (in seconds) of the window used to produce each matrix. Defaults to entire time series.tslide (
float) – Offset time (in seconds) between each successive window start time. Defaults to twindow/2. Set to 0 to produce only a single matrix.newname (
str) – Name of the tplot variable to receive the MVA rotation matrices.evname (
str) – Name of the tplot variable to receive the eigenvalues at each window.tminname (
str) – Name of the tplot variable to receive the basis vectors for the minimum variance direction.tmidname (
str) – Name of the tplot variable to receive the basis vectors for the intermediate variance direction.tmaxname (
str) – Name of the tplot variable to receive the basis vectors for the maximum variance direction.
- Returns:
The list of tplot variables produced.
- Return type:
- pyspedas.minvar(data)[source]
This program computes the principal variance directions and variances of a vector quantity as well as the associated eigenvalues.
- Parameters:
data – Vxyz, an (npoints, ndim) array of data(ie Nx3)
- Returns:
vrot– an array of (npoints, ndim) containing the rotated data in the new coordinate system, ijk. Vi(maximum direction)=vrot[0,:] Vj(intermediate direction)=vrot[1,:] Vk(minimum variance direction)=Vrot[2,:]v– an (ndim,ndim) array containing the principal axes vectors Maximum variance direction eigenvector, Vi=v[,0] Intermediate variance direction, Vj=v[,1] (descending order)w– the eigenvalues of the computation
LMN Coordinates
In this coordinate system, a set of basis vectors L, M, N are produced, using the probe position, magnetic field direction, and some solar wind parameters, using the Shue model for the magnetopause boundary location. The N component will be normal to the magnetopause boundary with the other two components in the tangent plane. The output is a set of rotation matrices over time, suitable for use with the tvector_rotate utility.
- pyspedas.lmn_matrix_make(pos_var_name, mag_var_name, trange=None, hro2=False, newname=None)[source]
Generate an LMN (boundary-normal) coordinate transformation matrix from the given magnetic field B and position data, and store it in a tplot variable using the GSM to LMN transformation.
- Parameters:
pos_var_name (
str) – Name of tplot variable containing the spacecraft position data in GSM coordinates.mag_var_name (
str) – Name of tplot variable containing the magnetic field data in GSM coordinates.trange (
list, optional) – Time range to use for interpolation. If None, the time range will be set from the mag_var_name tplot variable.- hro2 (
bool, optional) – Flag indicating whether to use the HRO2 level of OMNI data. If False, the HRO level will be used. Default is False.
- newnamestr, optional
Name of the output tplot variable. Defaults to mag_var_name + “_lmn_mat”.
- hro2 (
- Returns:
The name of the output tplot variable containing the LMN matrix, or None if an error occurs.
- Return type:
Rotate Vectors by Rotation Matrix
Several of the specialized coordinate transforms (for example, FAC, LMN, or MVA) are implemented by generating a rotation matrix to transform vectors from the original system to the target system. The tvector_rotate routine applies these rotation matrices to tplot variables containing vectors in the original coordinate system, performing any necessary interpolation of the rotation matrices to match the timestamps of the vectors being transformed.
- pyspedas.tvector_rotate(mat_var_in, vec_var_in, newname=None)[source]
Rotates tplot vector data by a set of coordinate ransformation matrices and outputs tplot variables. This is designed mainly for use with fac_matrix_make, but can be used for more general purposes. The input variable containing the rotation matrices is automatically interpolated to the timestamps in the vec_var_in variables, using the qslerp (Quaternion Spherical Linear intERPolation) routine from the PySPEDAS quaternion library.
Getting/Setting the Coordinate System for tplot variables
- pyspedas.get_coords(name)[source]
This function returns the coordinate system of a tplot variable
- Parameters:
name (
str) – name of the tplot variable
Notes
- The coordinate system is stored in the variable’s metadata at:
metadata[‘data_att’][‘coord_sys’]
See pyspedas.get_coords() to update the coordinate system
- Returns:
Coordinate systemofthe tplot variableorNone if the coordinate system isn't set
Examples
>>> import pyspedas >>> pyspedas.projects.themis.state(trange=['2007-06-23', '2007-06-24'], probe='a') >>> pyspedas.get_coords('tha_pos')
- pyspedas.set_coords(name, coords)[source]
This function sets the coordinate system of a tplot variable, and updates legend names and axis labels if they include the coordinate system.
- Parameters:
Notes
- The coordinate system is stored in the variable’s metadata at:
metadata[‘data_att’][‘coord_sys’]
See pyspedas.get_coords() to return the coordinate system
- Returns:
bool
- Return type:
True/False depending on if the operation was successful
Examples
>>> import pyspedas >>> pyspedas.projects.themis.state(trange=['2007-06-23', '2007-06-24'], probe='a') >>> pyspedas.set_coords('tha_pos', 'GEI')
Quaternion Routines
Quaternions can be used to represent rotations in 3-D space, much like Euler angles or rotation matrices. They are often more computationally convenient and efficient. They are represented in PySPEDAS as 4-element floating point arrays, which can be thought of as a scalar component encoding the rotation angle, and 3 vector components encoding the rotation axis.
Convertiong to/from axis-angle rotation specification
- pyspedas.qcompose(vec, theta, free=True)[source]
Compose quaternions from rotation axis vectors and rotation angles
- Parameters:
vec (
3 element arrayoran Nx3 element array)theta (
an angleoran N element arrayofangles(in radians))free (
Flagtoallow thetas outside [0,pi))
- Return type:
a 4 element quaternionoran Nx4 element arrayofquaternions
Notes
Implementation largely copied from the euve c library for quaternions Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This routine is based on the IDL version by Patrick Cruce
- pyspedas.qdecompose(q)[source]
Decompose quaternions into axes and angles
- Parameters:
q (
a 4 element quaternionoran Nx4 element arrayofquaternions)- Returns:
a 4 element array with a[0] = angle, and a[1 (
3] = axis,or)an Nx4 element arrayor-1L on failure
Notes
Implementation largely copied from the euve c library for quaternions Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs As per the euve implementation, if q[0] is outside of the range of acos…[-1,1] the value of the quaternion will be turned into an identity quaternion…in other words clipped, this seems suspect, a better solution may be to wrap the value back into range using modular arithmatic, future modifiers of this routine should consider adding this.
This routine is based on the IDL version by Patrick Cruce
Converting to/from rotation matrices
- pyspedas.mtoq(m)[source]
Transform a rotation matrix into a quaternion. If the matrix does not perform a rotation, then its behavior may be ill-defined
WARNING!!!! - this routine does not conform to the wikipedia definition. see warning for qtom.pro
- Parameters:
m (
a 3x3 element arrayoran Nx3x3 element array)- Returns:
qNotes (
Implementation largely copied from the euve c library for)quaternionsRepresention has::– q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector zThe vector componentofthe quaternion can also be thoughtofasan eigenvalueofthe rotation the quaterion performsThis routine is based on the IDL version by Patrick Cruce
- pyspedas.qtom(qi)[source]
Transforms quaternions into rotation matrices
WARNING!!! It appears that this routine returns the transpose (inverse) of the rotation matrix! It differs from the CSPICE library and Wikipedia
- Parameters:
qi (
a 4 element array representing a quaternionora Nx4 element array representing an arrayofquaternions)- Return type:
a 3x3 matrixorNx3x3 array
Notes
Implementation largely copied from the euve c library for quaternions Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This routine is based on the IDL version by Patrick Cruce
Combining quaternions (by multiplying)
- pyspedas.qmult(q1, q2)[source]
multiply two quaternions or two arrays of quaternions
- Parameters:
q1 (
array_like) – a 4 element array, or an Nx4 element array, representing quaternion(s)q2 (
array_like) – a 4 element array, or an Nx4 element array, representing quaternion(s)
- Return type:
q1*q2, or-1 on failure
Notes
Implementation largely copied from the euve c library for quaternions
Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This routine is based on the IDL version by Patrick Cruce
Interpolating rotations (Quaternion Spherical Linear intERPolation)
- pyspedas.qslerp(q, x1, x2, geometric=False, eq_tolerance=1e-12)[source]
Uses spherical linear interpolation to interpolate quaternions between elements of q
- Parameters:
q (
array_like) – An Nx4 element array, representing a list of quaternions with N > 1, all quaternions must be unit quaternions(ie length/norm = 1)x1 (
array_like) – The input abscissa values of the quaternions,an array of length N, abscissa values must also be monotonicx2 (
array_like) – The output abscissa values for the quaternions, can have as many elements as wanted but must fall on the interval [x[0],x[N-1]], an M element array, abscissa values must also be monotonicgeometric (
bool, optional) – This keyword allows you to specify that it use the geometric formula for the slerp. The default formula is probably faster and more numerically stable, the geometric option is just available for testing Testing of the geometric method indicates that the norm of the interpolated quaternions strays easily from unit length, when it renormalizes results may be destabilizedeq_tolerance (
float, optional) –- Set to specify the tolerance used when determining whether two numbers are equal (default: 1e-12). This tolerance will be used in checking equivalence of:
-quaternion lengths -input vs. output abscissae -quaternion direction (inner product)
- Returns:
q_out – An Mx4 element array of interpolated quaternions or -1L on failure
- Return type:
array_like
Notes
Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
The scalar component can be thought of as the amount of rotation that the quaternion performs
While the code may seem a little esoteric, it is vectorized and provides the most accurate results it can get
This routine is based on the IDL version by Patrick Cruce
Other operations
- pyspedas.qnorm(q)[source]
Calculate the norm a quaternion or an array of quaternions
- Parameters:
q (
a 4 element array, oran Nx4 element array,representing quaternion(s))- Returns:
norm(q) – will be a single element or an N length array
- Return type:
sqrt(a^2+b^2+c^2+d^2)or-1L on fail
Notes
Implementation largely copied from the euve c library for quaternions Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This implementation of norm does not apply the squareroot sometimes applied to a norm. If required the sqrt can easily be applied by the user
This routine is based on the IDL version by Patrick Cruce
- pyspedas.qnormalize(q)[source]
Normalize a quaternion or an array of quaternions
- Parameters:
q (
a 4 element array, oran Nx4 element array,representing quaternion(s))- Return type:
q/(sqrt(norm(q)))or-1L on fail
Notes
Implementation largely copied from the euve c library for quaternions Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This routine is based on the IDL version by Patrick Cruce
- pyspedas.qvalidate(q, argname, fxname)[source]
Validate inputs for the PySPEDAS quaternion library
- Parameters:
q (
a 4 element array, oran Nx4 element array,representing quaternion(s))argname (
the nameofthe argumenttobe used in error messages)
- Returns:
an Nx4 arrayor-1,it will turn 4 element quaternion arrays into 1x4 element quaternion arrays
Notes
This function is here because I noticed a lot of the error checking code was being repeated, and it was making the functions long and hard to read
Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This routine is based on the IDL version by Patrick Cruce
- pyspedas.qconj(q)[source]
Calculate the conjugate of a quaternion or an array of quaternions
- Parameters:
q (
a 4 element array, oran Nx4 element array,representing quaternion(s))- Return type:
q*
Notes
Implementation largely copied from the euve c library for quaternions Represention has:
q[0] = scalar component q[1] = vector x q[2] = vector y q[3] = vector z
The vector component of the quaternion can also be thought of as an eigenvalue of the rotation the quaterion performs
This routine is based on the IDL version by Patrick Cruce
Support Routines
The routines listed here are generally not called directly by users. They are listed here for completeness.
- pyspedas.cotrans_tools.cotrans_lib.get_time_parts(time_in)[source]
Split time into year, doy, hours, minutes, seconds.fsec.
- pyspedas.cotrans_tools.cotrans_lib.csundir_vect(time_in)[source]
Calculate the direction of the sun.
- Parameters:
- Returns:
- pyspedas.cotrans_tools.cotrans_lib.cdipdir(time_in=None, iyear=None, idoy=None)[source]
Compute dipole direction in GEO coordinates.
Notes
Compute geodipole axis direction from International Geomagnetic Reference Field (IGRF-14) model for time interval 1965 to 2030. For time out of interval, computation is made for nearest boundary. Same as SPEDAS cdipdir.
- pyspedas.cotrans_tools.cotrans_lib.cdipdir_vect(time_in=None, iyear=None, idoy=None)[source]
Compute dipole direction in GEO coordinates.
Similar to cdipdir but for arrays.
- Parameters:
- Return type:
Notes
Same as SPEDAS cdipdir_vec.
- pyspedas.cotrans_tools.cotrans_lib.tgeigse_vect(time_in, data_in)[source]
GEI to GSE transformation.
- pyspedas.cotrans_tools.cotrans_lib.subgei2gse(time_in, data_in)[source]
Transform data from GEI to GSE.
- pyspedas.cotrans_tools.cotrans_lib.tgsegei_vect(time_in, data_in)[source]
GSE to GEI transformation.
- pyspedas.cotrans_tools.cotrans_lib.subgse2gei(time_in, data_in)[source]
Transform data from GSE to GEI.
- pyspedas.cotrans_tools.cotrans_lib.tgsegsm_vect(time_in, data_in)[source]
Transform data from GSE to GSM.
- pyspedas.cotrans_tools.cotrans_lib.subgse2gsm(time_in, data_in)[source]
Transform data from GSE to GSM.
- pyspedas.cotrans_tools.cotrans_lib.tgsmgse_vect(time_in, data_in)[source]
Transform data from GSM to GSE.
- pyspedas.cotrans_tools.cotrans_lib.subgsm2gse(time_in, data_in)[source]
Transform data from GSM to GSE.
- pyspedas.cotrans_tools.cotrans_lib.tgsmsm_vect(time_in, data_in)[source]
Transform data from GSM to SM.
- pyspedas.cotrans_tools.cotrans_lib.subgsm2sm(time_in, data_in)[source]
Transform data from GSM to SM.
- pyspedas.cotrans_tools.cotrans_lib.tsmgsm_vect(time_in, data_in)[source]
Transform data from SM to GSM.
- pyspedas.cotrans_tools.cotrans_lib.subsm2gsm(time_in, data_in)[source]
Transform data from SM to GSM.
- pyspedas.cotrans_tools.cotrans_lib.subgei2geo(time_in, data_in)[source]
Transform data from GEI to GEO.
- pyspedas.cotrans_tools.cotrans_lib.subgeo2gei(time_in, data_in)[source]
Transform data from GEO to GEI.
- pyspedas.cotrans_tools.cotrans_lib.subgeo2mag(time_in, data_in)[source]
Transform data from GEO to MAG.
- Parameters:
- Returns:
Coordinates in MAG.
- Return type:
Arrayoffloat
Notes
Adapted from spedas IDL file geo2mag.pro.
- pyspedas.cotrans_tools.cotrans_lib.submag2geo(time_in, data_in)[source]
Transform data from MAG to GEO.
- Parameters:
- Returns:
Coordinates in GEO.
- Return type:
Arrayoffloat
Notes
Adapted from spedas IDL file mag2geo.pro.
- pyspedas.cotrans_tools.cotrans_lib.ctv_mm_mult(m1, m2)[source]
Vectorized multiplication of two lists of 3x3 matrices.
- Parameters:
- Returns:
Array (3, 3, n). List of n 3x3 matrices.
- Return type:
Arrayoffloat
Notes
Adapted from spedas IDL file matrix_array_lib.pro.
- pyspedas.cotrans_tools.cotrans_lib.j2000_matrix_vec(time_in)[source]
Get the conversion matrix for J2000 coordinates.
Gives a matrix that transforms from mean earth equator and equinox of J2000 into the true earth equator and equinox for the dates and times.
- Parameters:
- Returns:
Transformation matrix.
- Return type:
Matrixoffloat
Notes
Adapted from spedas IDL file spd_make_j2000_matrix_vec.pro.
- pyspedas.cotrans_tools.cotrans_lib.ctv_mx_vec_rot(m, v)[source]
Vectorized multiplication of n matrices by n vectors.
- Parameters:
- Returns:
Array (n, k). List of n vectors.
- Return type:
Arrayoffloat
Notes
Adapted from spedas IDL file matrix_array_lib.pro.
- pyspedas.cotrans_tools.cotrans_lib.subgei2j2000(time_in, data_in)[source]
Transform data from GEI to J2000.
- pyspedas.cotrans_tools.cotrans_lib.subj20002gei(time_in, data_in)[source]
Transform data from J2000 to GEI.