rightascension_to_hourangle
- ssapy.utils.rightascension_to_hourangle(right_ascension, local_time)[source][source]
Convert right ascension to hour angle.
This function calculates the hour angle of a celestial object based on its right ascension and the local time. The hour angle represents the angular distance between the object’s current position and the local meridian.
Parameters:
- right_ascension (float or str): The right ascension of the object. Can be provided as a
decimal degree value or as a string in “HH:MM:SS” format.
- local_time (float or str): The local time. Can be provided as a decimal degree value or
as a string in “HH:MM:SS” format.
Returns:
str: The hour angle in “HH:MM:SS” format.
Notes:
If right_ascension or local_time is provided as a decimal degree, it is converted to the appropriate “HH:MM:SS” or “DD:MM:SS” format internally.
Handles cases where the right ascension exceeds the local time by adjusting the local time to account for the 24-hour cycle.
Example:
rightascension_to_hourangle(“10:30:00”, “12:45:00”) -> “02:15:00” rightascension_to_hourangle(157.5, 191.25) -> “02:15:00”