aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-05-14 11:25:00 +0000
committerRichard M. Stallman2005-05-14 11:25:00 +0000
commit7fde7268e1f3c3a1cc6c0f7d1006a716fd4773bd (patch)
tree6f28ba15d0705dcd4fd8b1feb95adc0167604922
parent01147a5003b226bcf41d04b7dd70fe6e252be2e5 (diff)
downloademacs-7fde7268e1f3c3a1cc6c0f7d1006a716fd4773bd.tar.gz
emacs-7fde7268e1f3c3a1cc6c0f7d1006a716fd4773bd.zip
(solar-data-list): Move definition up.
-rw-r--r--lisp/calendar/solar.el84
1 files changed, 42 insertions, 42 deletions
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el
index 5eca356af59..e1c4950b24b 100644
--- a/lisp/calendar/solar.el
+++ b/lisp/calendar/solar.el
@@ -643,48 +643,6 @@ since January 1st, 2000, at 12 ET."
643 ; equation of time, in hours 643 ; equation of time, in hours
644 (list app i time-eq nut))) 644 (list app i time-eq nut)))
645 645
646(defun solar-longitude (d)
647 "Longitude of sun on astronomical (Julian) day number D.
648Accurary is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes).
649
650The values of calendar-daylight-savings-starts,
651calendar-daylight-savings-starts-time, calendar-daylight-savings-ends,
652calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and
653calendar-time-zone are used to interpret local time."
654 (let* ((a-d (calendar-absolute-from-astro d))
655 ;; get Universal Time
656 (date (calendar-astro-from-absolute
657 (- a-d
658 (if (dst-in-effect a-d)
659 (/ calendar-daylight-time-offset 24.0 60.0) 0)
660 (/ calendar-time-zone 60.0 24.0))))
661 ;; get Ephemeris Time
662 (date (+ date (solar-ephemeris-correction
663 (extract-calendar-year
664 (calendar-gregorian-from-absolute
665 (floor
666 (calendar-absolute-from-astro
667 date)))))))
668 (U (/ (- date 2451545) 3652500))
669 (longitude
670 (+ 4.9353929
671 (* 62833.1961680 U)
672 (* 0.0000001
673 (apply '+
674 (mapcar '(lambda (x)
675 (* (car x)
676 (sin (mod
677 (+ (car (cdr x))
678 (* (car (cdr (cdr x))) U))
679 (* 2 pi)))))
680 solar-data-list)))))
681 (aberration
682 (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973)))
683 (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 pi)))
684 (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 pi)))
685 (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2))))))
686 (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0)))
687
688(defconst solar-data-list 646(defconst solar-data-list
689 '((403406 4.721964 1.621043) 647 '((403406 4.721964 1.621043)
690 (195207 5.937458 62830.348067) 648 (195207 5.937458 62830.348067)
@@ -737,6 +695,48 @@ calendar-time-zone are used to interpret local time."
737 (10 1.50 21463.25) 695 (10 1.50 21463.25)
738 (10 2.55 157208.40))) 696 (10 2.55 157208.40)))
739 697
698(defun solar-longitude (d)
699 "Longitude of sun on astronomical (Julian) day number D.
700Accurary is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes).
701
702The values of calendar-daylight-savings-starts,
703calendar-daylight-savings-starts-time, calendar-daylight-savings-ends,
704calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and
705calendar-time-zone are used to interpret local time."
706 (let* ((a-d (calendar-absolute-from-astro d))
707 ;; get Universal Time
708 (date (calendar-astro-from-absolute
709 (- a-d
710 (if (dst-in-effect a-d)
711 (/ calendar-daylight-time-offset 24.0 60.0) 0)
712 (/ calendar-time-zone 60.0 24.0))))
713 ;; get Ephemeris Time
714 (date (+ date (solar-ephemeris-correction
715 (extract-calendar-year
716 (calendar-gregorian-from-absolute
717 (floor
718 (calendar-absolute-from-astro
719 date)))))))
720 (U (/ (- date 2451545) 3652500))
721 (longitude
722 (+ 4.9353929
723 (* 62833.1961680 U)
724 (* 0.0000001
725 (apply '+
726 (mapcar '(lambda (x)
727 (* (car x)
728 (sin (mod
729 (+ (car (cdr x))
730 (* (car (cdr (cdr x))) U))
731 (* 2 pi)))))
732 solar-data-list)))))
733 (aberration
734 (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973)))
735 (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 pi)))
736 (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 pi)))
737 (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2))))))
738 (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0)))
739
740(defun solar-ephemeris-correction (year) 740(defun solar-ephemeris-correction (year)
741 "Ephemeris time minus Universal Time during Gregorian year. 741 "Ephemeris time minus Universal Time during Gregorian year.
742Result is in days. 742Result is in days.