lstpressure.utils
utils
- lstpressure.utils.normalize_coordinates(lat, long) tuple[float, float]
fn
- lstpressure.utils.normalize_datetime(dt_input) datetime
Normalizes a datetime object (either a string or a date) to a datetime object
dt_input(“2023-12-20 00:00:00”): <class ‘datetime.datetime’> 2023-12-30 00:00:00 dt_input(datetime(2023, 12, 20, 0, 0, 0)): <class ‘datetime.datetime’> 2023-12-30 00:00:00
- lstpressure.utils.normalize_time_to_decimal(time: str | float) float
Convert a time string of format hours:min:sec to decimal hours.
Parameters:
- timestr
A time string formatted as “hours:min:sec”.
Returns:
- float
The time represented in decimal hours.
Raises:
- ValueError
If the input time is not a string or if it doesn’t have the expected format.
Example:
>>> time_to_decimal("2:30:0") 2.5
- lstpressure.utils.normalize_yyyymmdd_to_datetime(yyyymmdd) date
normalize_date In many cases it’s useful to create a date from a yyyymmdd string This helper function is to allow inputting either a string or date object and getting back a date object at 00:00 of that day
- lstpressure.utils.utc_to_lst(iso_date: str | datetime, lat: str | float = None, long: str | float = None, address: str = None) float
Convert a given UTC datetime to Local Sidereal Time (LST).
Parameters:
- iso_datestr | datetime
An ISO 8601 date string or datetime object representing UTC time.
- latstr | float
Latitude coordinate, can be a string (e.g., “52d40m”) or float.
- longstr | float
Longitude coordinate, can be a string (e.g., “4d55m”) or float.
- addressstr
Address that is resolved to lat/long (instead of passing lat/long) via OpenStreetMap API
Returns:
- float
The Local Sidereal Time in decimal hours.
Example:
>>> utc_to_lst("2023-10-26T12:00:00", "52d40m", "4d55m") 14.5567