Next / Previous / Contents / TCC Help System / NM Tech homepage

15.2. AltAz.raDec(): Horizon to equatorial coordinates

For a given observer's location and time, this method returns, as a RADec instance, the equatorial coordinates corresponding to self's horizon coordinates.

In Duffett-Smith, this is section 26. Here are the relevant formulae:

a Altitude.
A Azimuth.
φ The observer's geographic latitude.
δ Declination.
H Hour angle.
sidereal.py
# - - -   A l t A z . r a D e c

    def raDec ( self, lst, latLon ):
        """Convert horizon coordinates to equatorial.

          [ (lst is a local sidereal time as a SiderealTime instance) and
            (latLon is the observer's position as a LatLon instance) ->
              return the corresponding equatorial coordinates as a
              RADec instance ]            
        """

As Duffett-Smith points out, the horizon-to-equatorial conversion in either direction uses the same formula. Hence, the actual calculation of δ and H is handled by Section 16, “coordRotate(): Rotation of spherical coordinates”.

sidereal.py
        #-- 1 --
        # [ dec  :=  declination of self at latLon in radians
        #   hourRadians  :=  hour angle of self at latlon in radians ]
        dec, hourRadians  =  coordRotate ( self.alt, latLon.lat,
                                           self.az )

        #-- 2 --
        # [ hourRadians is an hour angle in radians ->
        #     h  :=  hourRadians in hours ]
        h  =  radiansToHours ( hourRadians )

The conversion of hour angle and LST to right ascension uses the same technique as in Section 9.3, “hourAngleToRA(): Convert an hour angle to right ascension”: subtract the hour angle from the LST, and normalize. Then we convert it to radians, instantiate an RADec, and return the instance.

sidereal.py
        #-- 3 --
        # [ ra  :=  right ascension for hour angle (h) at local
        #           sidereal time (lst) and location (latLon) ]
        ra  =  hoursToRadians ( ( lst.hours - h ) % 24.0 )

        #-- 4 --
        return  RADec ( ra, dec )