spacepy.coordinates.Coords

class spacepy.coordinates.Coords(data, dtype, carsph[, units, ticks])[source]

A class holding spatial coordinates in Cartesian/spherical in units of Re and degrees

Coordinate transforms are based on the IRBEM library; its manual may prove useful. For a good reference on heliospheric and magnetospheric coordinate systems, see Franz & Harper, “Heliospheric Coordinate Systems”, Planet. Space Sci., 50, pp 217-233, 2002 (https://doi.org/10.1016/S0032-0633(01)00119-2).

Parameters:

data : list or ndarray, dim = (n,3)

coordinate points [X,Y,Z] or [rad, lat, lon]

dtype : string

coordinate system; possible values are:

  • GDZ (Geodetic; WGS84),
  • GEO (Geographic Coordinate System),
  • GSM (Geocentric Solar Magnetospheric),
  • GSE (Geocentric Solar Ecliptic),
  • SM (Solar Magnetic),
  • GEI (Geocentric Equatorial Inertial; True-of-Date),
  • MAG (Geomagnetic Coordinate System),
  • SPH (Spherical Coordinate System),
  • RLL (Radius, Latitude, Longitude; Geodetic)

carsph : string

Cartesian or spherical, ‘car’ or ‘sph’

units : list of strings, optional

standard are [‘Re’, ‘Re’, ‘Re’] or [‘Re’, ‘deg’, ‘deg’] depending on the carsph content

ticks : Ticktock instance, optional

used for coordinate transformations (see a.convert)

Returns:

out : Coords instance

instance with a.data, a.carsph, etc.

Examples

>>> from spacepy import coordinates as coord
>>> cvals = coord.Coords([[1,2,4],[1,2,2]], 'GEO', 'car')
>>> cvals.x  # returns all x coordinates
array([1, 1])
>>> from spacepy.time import Ticktock
>>> cvals.ticks = Ticktock(['2002-02-02T12:00:00', '2002-02-02T12:00:00'], 'ISO') # add ticks
>>> newcoord = cvals.convert('GSM', 'sph')
>>> newcoord
append(other) Append another Coords instance to the current one
convert(returntype, returncarsph) Create a new Coords instance with new coordinate types
append(other)[source]

Append another Coords instance to the current one

Parameters:

other : Coords instance

Coords instance to append

convert(returntype, returncarsph)[source]

Create a new Coords instance with new coordinate types

Parameters:

returntype : string

coordinate system, possible are GDZ, GEO, GSM, GSE, SM, GEI, MAG, SPH, RLL

returncarsph : string

coordinate type, possible ‘car’ for Cartesian and ‘sph’ for spherical

Returns:

out : Coords object

Coords object in the new coordinate system

Examples

>>> from spacepy.coordinates import Coords
>>> y = Coords([[1,2,4],[1,2,2]], 'GEO', 'car')
>>> from spacepy.time import Ticktock
>>> y.ticks = Ticktock(['2002-02-02T12:00:00', '2002-02-02T12:00:00'], 'ISO')
>>> x = y.convert('SM','car')
>>> x
Coords( [[ 0.81134097  2.6493305   3.6500375 ]
 [ 0.92060408  2.30678864  1.68262126]] ), dtype=SM,car, units=['Re', 'Re', 'Re']