xyz_to_ecliptic

ssapy.utils.xyz_to_ecliptic(xc, yc, zc, xe=0, ye=0, ze=0, degrees=False)[source][source]

Convert rectangular coordinates (X, Y, Z) to ecliptic longitude and latitude.

This function computes the ecliptic longitude and latitude of an object relative to the Earth or another reference point, given its rectangular coordinates in the ecliptic coordinate system.

Parameters:

xc (float): X-coordinate of the object in the ecliptic coordinate system. yc (float): Y-coordinate of the object in the ecliptic coordinate system. zc (float): Z-coordinate of the object in the ecliptic coordinate system. xe (float, optional): X-coordinate of the reference point (default is 0, typically Earth’s position). ye (float, optional): Y-coordinate of the reference point (default is 0, typically Earth’s position). ze (float, optional): Z-coordinate of the reference point (default is 0, typically Earth’s position). degrees (bool, optional): If True, returns the longitude and latitude in degrees;

otherwise, returns them in radians (default is False).

Returns:

tuple: A tuple containing:
  • ec_longitude (float): Ecliptic longitude of the object (in radians or degrees).

  • ec_latitude (float): Ecliptic latitude of the object (in radians or degrees).

Notes:

  • The calculation involves finding the vector from the reference point to the object and determining its magnitude and angular position.

  • The rad0to2pi function ensures the longitude is normalized to the range [0, 2π] in radians.

  • The np.arctan2 function is used to compute the longitude, and np.arcsin is used for latitude.

  • If degrees=True, the results are converted from radians to degrees using np.degrees.

Example:

xyz_to_ecliptic(1.0, 0.5, 0.3, xe=0.1, ye=0.2, ze=0.3, degrees=True) -> (longitude, latitude)