spacepy.ctrans.CTrans

class spacepy.ctrans.CTrans(ctime, ephmodel=None, pnmodel=None, eop=False)[source]

Coordinate transformation class for a single instance in time

A general coordinate conversion routine, which takes a numpy array (Nx3) of Cartesian vectors along with the names of the input and output coordinate systems and returns an array of the converted coordinates.

Parameters
ctime(spacepy.time.Ticktock, datetime, float, string)

Input time stamp. Must have one time only. Accepted input formats

Returns
outCTrans

instance with self.convert, etc.

Other Parameters
ephmodelstr, optional

Select ephemerides model (e.g., for determining Sun direction). Currently only ‘LGMDEFAULT’ is supported, for consistency with LANLGeoMag implementation.

pnmodelstr, optional

Select precession/nutation model set. Options are: ‘IAU82’ (default), and ‘IAU00’.

eopbool, optional

Use Earth Orientation Parameters

Notes

New in version 0.3.0.

Methods

calcTimes([recalc])

Calculate time in systems required to set up coordinate transforms

calcOrbitParams([recalc])

Calculate Earth orbit parameters needed for coordinate transforms

calcCoreTransforms([recalc])

Calculate core coordinate transform matrices

calcMagTransforms([recalc])

Calculate geophysical coordinate systems

convert(vec, sys_in, sys_out[, defaults])

Convert an input vector between two coordinate systems

getEOP([useEOP])

Get/set Earth Orientation Parameters

gmst()

Calculate Greenwich Mean Sidereal Time

calcTimes(recalc=False, **kwargs)[source]

Calculate time in systems required to set up coordinate transforms

Sets Julian Date and Julian centuries in UTC, TAI, UT1, and TT systems.

Parameters
recalcbool, optional

If True, recalculate the times for coordinate transformation. Default is False.

calcOrbitParams(recalc=False)[source]

Calculate Earth orbit parameters needed for coordinate transforms

Calculates Earth’s orbital parameters required for defining coordinate system transformations, such as orbital eccentricity, the obliquity of the ecliptic, anomalies, and precession angles.

Parameters
recalcbool, optional

If True, recalculate the orbital parameters for coordinate transformation. Default is False.

calcCoreTransforms(recalc=False)[source]

Calculate core coordinate transform matrices

These coordinate systems do not require information about Earth’s magnetic field. The systems are: Earth-Centered Inertial, J2000 (ECI2000) Earth-Centered Inertial, Mean-of-date (ECIMOD) Earth-Centered Inertial, True-of-date (ECITOD) Geocentric Solar Ecliptic (GSE) Geocentric Geographic (GEO)

Parameters
recalcbool, optional

If True, recalculate the core (non-magnetic) coordinate transformations. Default is False.

calcMagTransforms(recalc=False)[source]

Calculate geophysical coordinate systems

Calculate transforms for coordinate systems requiring magnetic field information.

These are: Solar Magnetic (SM) Geocentric Solar Magnetospheric (GSM) Geomagnetic, centered dipole (CDMAG)

Parameters
recalcbool, optional

If True, recalculate the core (non-magnetic) coordinate transformations. Default is False.

convert(vec, sys_in, sys_out, defaults=None)[source]

Convert an input vector between two coordinate systems

Parameters
vecarray-like

Input 3-vector (can be an array of input 3-vectors) to convert. E.g., for 2D input the array must be like [[x1, y1, z1], [x2, y2, z2]]

sys_instr

String name for initial coordinate system. For supported systems, see module level documentation.

sys_outstr

String name for target coordinate system. For supported systems, see module level documentation.

Other Parameters
defaultsnamedtuple or None

Named tuple containing default settings passed from Coordinates module

getEOP(useEOP=False)[source]

Get/set Earth Orientation Parameters

Parameters
useEOPbool

If True, use Earth Orientation Parameters. Default False.

Notes

Currently Earth Orientation Parameters are all set to zero. Use is not yet supported.

gmst()[source]

Calculate Greenwich Mean Sidereal Time

Notes

The formulation used to calculate GMST is selected using the status of the ‘pnmodel’ variable in the CTrans object attributes.