Skip to content

Commit

Permalink
feat: Added Transit type to transit module in @observerly/astrometry.
Browse files Browse the repository at this point in the history
feat: Added Transit type to transit module in @observerly/astrometry.
  • Loading branch information
michealroberts committed Aug 28, 2023
1 parent 8310de0 commit 41522ae
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions src/transit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,43 @@ export interface Parameters {

/*****************************************************************************************************************/

export interface Transit {
/**
*
*
* The local sidereal time of rise.
*
*
*/
LSTr: number
/**
*
*
* The local sidereal time of set.
*
*
*/
LSTs: number
/**
*
*
* The azimuthal angle (in degrees) of the object at rise.
*
*
*/
R: number
/**
*
*
* The azimuthal angle (in degrees) of the object at set.
*
*
*/
S: number
}

/*****************************************************************************************************************/

/**
*
* isBodyCircumpolar()
Expand Down Expand Up @@ -174,3 +211,46 @@ export const doesBodyRiseOrSet = (
}

/*****************************************************************************************************************/

export const getTransit = (
observer: GeographicCoordinate,
target: EquatorialCoordinate,
) => :
"""
Determines the local sidereal time and azimuthal angle of rise and set for an object.
:param observer: The geographic coordinate of the observer.
:param target: The equatorial coordinate of the observed object.
:return either None when the object does not rise or set or the transit timings.
"""
# Convert the right ascension to hours:
ra = target["ra"] / 15
# Get the transit parameters:
obj = get_does_object_rise_or_set(observer, target)
if not obj:
return None
H1 = obj["H1"]
H2 = degrees(acos(-H1)) / 15
# Get the azimuthal angle of rise:
R = degrees(acos(obj["Ar"]))
# Get the azimuthal angle of set:
S = 360 - R
# The local sidereal time of rise:
LSTr = 24 + ra - H2
if LSTr > 24:
LSTr -= 24
LSTs = ra + H2
if LSTs > 24:
LSTs -= 24
return {"LSTr": LSTr, "LSTs": LSTs, "R": R, "S": S}

0 comments on commit 41522ae

Please sign in to comment.