Astrex.Common (Astrex v0.4.1)
View SourceCommon utilities to facilitate the astronomical calculations
- unit conversions: hours, degrees, angles
- normalizations within 360°, 2PI, 24 hours
- conversion from hour:minutes:seconds to hours and back
- conversion from degree:minutes:seconds to degrees and back
Summary
Functions
formats an angle from degrees to a string "dd:mm:ss"
converts an angle expressed in degrees to an angle expressed in hours
Converts a "dd:mm:ss" string to degrees Receives the angle in d° m' s" as a binary string Returns the angle in DEGREES (float)
Converts a "hh:mm:ss" string to hours receives a binary string returns HOURS in float format
converts an angle expressed in hours to an angle expressed in degrees
formats an hour from hours to a string "hh:mm:ss"
converts an angle expressed in hours to an angle expressed in radians
Converts all values of a map from radians to degrees.
Converts all values of a map from degrees to radians.
returns the current time
Normalizes an angle into the range 0-2 pi Receives the angle in RADIANS Returns the normalized angle in RADIANS
Normalizes an hour angle into the range 0-24 hours Receives the angle in HOURS Returns the normalized angle in HOURS
Normalizes an angle into the range 0°-360° Receives the angle in DEGREES Returns the normalized angle in DEGREES
converts an angle expressed in radians to an angle expressed in hours
Functions
formats an angle from degrees to a string "dd:mm:ss"
Examples
iex> Astrex.Common.hours2hms(174.1234)
"174:07:24"
converts an angle expressed in degrees to an angle expressed in hours
Converts a "dd:mm:ss" string to degrees Receives the angle in d° m' s" as a binary string Returns the angle in DEGREES (float)
Converts a "hh:mm:ss" string to hours receives a binary string returns HOURS in float format
Examples
iex> Astrex.Common.hms2hours("12:33:31")
12.558611111111112
converts an angle expressed in hours to an angle expressed in degrees
formats an hour from hours to a string "hh:mm:ss"
Examples
iex> Astrex.Common.hours2hms(12.5587)
"12:33:31"
converts an angle expressed in hours to an angle expressed in radians
Converts all values of a map from radians to degrees.
Converts all values of a map from degrees to radians.
returns the current time:
- system time if production
- mock time is testing
Normalizes an angle into the range 0-2 pi Receives the angle in RADIANS Returns the normalized angle in RADIANS
Normalizes an hour angle into the range 0-24 hours Receives the angle in HOURS Returns the normalized angle in HOURS
Normalizes an angle into the range 0°-360° Receives the angle in DEGREES Returns the normalized angle in DEGREES
converts an angle expressed in radians to an angle expressed in hours