astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- Astronomical Coordinate Systems (`astropy.coordinates`) »
- cartesian_to_spherical

# cartesian_to_spherical

`astropy.coordinates.distances.``cartesian_to_spherical`(x, y, z)

  Converts 3D rectangular cartesian coordinates to spherical polar coordinates.

  Note that the resulting angles are latitude/longitude or elevation/azimuthal form. I.e., the origin is along the equator rather than at the north pole.

  Note

  This is a low-level function used internally in `astropy.coordinates`. It is provided for users if they really want to use it, but it is recommended that you use the `astropy.coordinates` coordinate systems.

  Parameters:

  x : scalar or array-like

  > The first cartesian coordinate.

  y : scalar or array-like

  > The second cartesian coordinate.

  z : scalar or array-like

  > The third cartesian coordinate.

  Returns:

  r : float or array

  > The radial coordinate (in the same units as the inputs).

  lat : float or array

  > The latitude in radians

  lon : float or array

  > The longitude in radians