### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- coordinates - module for coordinate transforms »

# spacepy.coordinates.Coords

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

  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. There is good background information on space physics coordinate systems at SPENVIS and RAL

  Parameters: | data : list or ndarray, dim = (n,3) coordinate points [X,Y,Z] or [rad, lat, lon] dtype : string coordinate system, possible are GDZ, GEO, GSM, GSE, SM, GEI, MAG, SPH, RLL 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.

  See also

  `spacepy.time.Ticktock`

  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)

    Append another Coords instance to the current one

    Parameters: | other : Coords instance Coords instance to append

  `convert`(returntype, returncarsph)

    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']

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- coordinates - module for coordinate transforms »