src.api.utils.time_utils module
- src.api.utils.time_utils.astropy_time_to_datetime_utc(time_obj: Time) datetime[source]
Convert an astropy Time object to a timezone-aware Python datetime (UTC).
- Parameters:
time_obj – Astropy Time object to convert
- Returns:
datetime.datetime object with UTC timezone
- src.api.utils.time_utils.calculate_lst(longitude: float, jd: float) float[source]
Calculate Local Sidereal Time (LST) based on longitude and Julian Day (JD).
This function calculates the Greenwich Sidereal Time (GST) and then adjusts it based on the given longitude to calculate the LST.
- Parameters:
longitude (float) – The longitude in degrees.
jd (float) – The Julian Day.
- Returns:
The LST in radians.
- Return type:
float
- src.api.utils.time_utils.ensure_datetime(date_value: Any) datetime[source]
Ensure that the input is a datetime object with timezone info.
- Parameters:
date_value – A datetime object or a string representing a date/time
- Returns:
A datetime object with timezone info
- Raises:
TypeError – If the input cannot be converted to a datetime object
- src.api.utils.time_utils.jd_to_gst(jd: float, nutation: float) float[source]
Convert Julian Day (JD) to Greenwich Apparent Sidereal Time (GAST).
This function calculates the GAST based on the JD and nutation.
- Parameters:
jd (float) – The Julian Day.
nutation (float) – The nutation in degrees.
- Returns:
The GAST in radians.
- Return type:
float