Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for time and angle conversions.

Helper functions for common operations: Julian Date to centuries conversion, angle normalization, and angular differences. These are building blocks used throughout the library.

§Time Conversion

jd_to_centuries converts a two-part Julian Date to Julian centuries from J2000.0, the time unit used by most IAU precession/nutation models.

§Angle Normalization

FunctionInputOutput Range
normalize_longitudedegrees(-180°, 180°]
normalize_latitudedegrees[-90°, 90°] (clamped)
normalize_angle_radradians(-π, π]

§Angular Difference

angular_difference computes the shortest signed difference between two angles in degrees, handling the wraparound at ±180°.

Functions§

angular_difference
Computes the shortest signed angular difference a - b in degrees.
jd_to_centuries
Converts a two-part Julian Date to Julian centuries from J2000.0.
normalize_angle_rad
Normalizes an angle in radians to the range (-π, π].
normalize_angle_to_positive
Normalizes an angle in radians to the range [0, 2π).
normalize_latitude
Clamps latitude to the valid range [-90°, 90°].
normalize_longitude
Normalizes longitude to the range (-180°, 180°].