Function: solar-horizontal-coordinates
solar-horizontal-coordinates is a byte-compiled function defined in
solar.el.gz.
Signature
(solar-horizontal-coordinates TIME LATITUDE LONGITUDE SUNRISE-FLAG)
Documentation
Azimuth and height of the sun at TIME, LATITUDE, and LONGITUDE.
TIME is a pair with the first component being the number of
Julian centuries elapsed at 0 Universal Time, and the second
component counting Universal Time hours. For instance, the pair
corresponding to November 28, 1995 at 16 UT is (-0.040945 16),
-0.040945 being the number of Julian centuries elapsed between
Jan 1, 2000 at 12 UT and November 28, 1995 at 0 UT. SUNRISE-FLAG
is passed to solar-ecliptic-coordinates. Azimuth and
height (between -180 and 180) are both in degrees.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/solar.el.gz
(defun solar-horizontal-coordinates (time latitude longitude sunrise-flag)
"Azimuth and height of the sun at TIME, LATITUDE, and LONGITUDE.
TIME is a pair with the first component being the number of
Julian centuries elapsed at 0 Universal Time, and the second
component counting Universal Time hours. For instance, the pair
corresponding to November 28, 1995 at 16 UT is (-0.040945 16),
-0.040945 being the number of Julian centuries elapsed between
Jan 1, 2000 at 12 UT and November 28, 1995 at 0 UT. SUNRISE-FLAG
is passed to `solar-ecliptic-coordinates'. Azimuth and
height (between -180 and 180) are both in degrees."
(let* ((ut (cadr time))
(ec (solar-equatorial-coordinates time sunrise-flag))
(st (+ solar-sidereal-time-greenwich-midnight
(* ut 1.00273790935)))
;; Hour angle (in degrees).
(ah (- (* st 15) (* 15 (car ec)) (* -1 longitude)))
(de (cadr ec))
(azimuth (solar-atn2 (- (* (solar-cosine-degrees ah)
(solar-sin-degrees latitude))
(* (solar-tangent-degrees de)
(solar-cosine-degrees latitude)))
(solar-sin-degrees ah)))
(height (solar-arcsin
(+ (* (solar-sin-degrees latitude) (solar-sin-degrees de))
(* (solar-cosine-degrees latitude)
(solar-cosine-degrees de)
(solar-cosine-degrees ah))))))
(if (> height 180) (setq height (- height 360)))
(list azimuth height)))