astropy:docs

Note

This is an old version of the documentation. See http://docs.astropy.org/en/stable for the latest version.

spherical_to_cartesian

astropy.coordinates.spherical_to_cartesian(r, lat, lon)[source] [edit on github]

Converts spherical polar coordinates to rectangular cartesian coordinates.

Note that the input angles should be in 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:

r : scalar, array-like, or Quantity

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

lat : scalar, array-like, or Quantity

The latitude (in radians if array or scalar)

lon : scalar, array-like, or Quantity

The longitude (in radians if array or scalar)

Returns:

x : float or array

The first cartesian coordinate.

y : float or array

The second cartesian coordinate.

z : float or array

The third cartesian coordinate.

Page Contents