imap_processing.spice.geometry.cartesian_to_spherical#

imap_processing.spice.geometry.cartesian_to_spherical(v: ndarray[tuple[int, ...], dtype[_ScalarType_co]], degrees: bool = True) ndarray[tuple[int, ...], dtype[_ScalarType_co]]#

Convert cartesian coordinates to spherical coordinates.

Parameters:
  • v (np.ndarray) – A NumPy array with shape (n, 3) where each row represents a vector with x, y, z-components.

  • degrees (bool) – If True, the azimuth and elevation angles are returned in degrees. Defaults to True.

Returns:

spherical_coords – A NumPy array with shape (n, 3), where each row contains the spherical coordinates (r, azimuth, elevation):

  • r : Distance of the point from the origin.

  • azimuth : angle in the xy-plane In degrees if degrees parameter is True (by default): output range=[0, 360) degrees, otherwise in radians if degrees parameter is False: output range=[0, 2*pi) radians.

  • elevation : angle from the xy-plane In degrees if degrees parameter is True (by default): output range=[-90, 90) degrees, otherwise in radians if degrees parameter is False: output range=[-pi/2, pi/2) radians.

Return type:

np.ndarray