/[emacs]/emacs/lisp/calendar/solar.el
ViewVC logotype

Diff of /emacs/lisp/calendar/solar.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by gm, Sat May 7 22:41:52 2005 UTC revision 1.54 by rms, Sat May 14 11:25:00 2005 UTC
# Line 643  since January 1st, 2000, at 12 ET." Line 643  since January 1st, 2000, at 12 ET."
643                    ; equation of time, in hours                    ; equation of time, in hours
644      (list app i time-eq nut)))      (list app i time-eq nut)))
645    
 (defun solar-longitude (d)  
   "Longitude of sun on astronomical (Julian) day number D.  
 Accurary is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes).  
   
 The values of calendar-daylight-savings-starts,  
 calendar-daylight-savings-starts-time, calendar-daylight-savings-ends,  
 calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and  
 calendar-time-zone are used to interpret local time."  
   (let* ((a-d (calendar-absolute-from-astro d))  
          ;; get Universal Time  
          (date (calendar-astro-from-absolute  
                 (- a-d  
                    (if (dst-in-effect a-d)  
                        (/ calendar-daylight-time-offset 24.0 60.0) 0)  
                    (/ calendar-time-zone 60.0 24.0))))  
          ;; get Ephemeris Time  
          (date (+ date (solar-ephemeris-correction  
                         (extract-calendar-year  
                          (calendar-gregorian-from-absolute  
                           (floor  
                            (calendar-absolute-from-astro  
                             date)))))))  
          (U (/ (- date 2451545) 3652500))  
          (longitude  
           (+ 4.9353929  
              (* 62833.1961680 U)  
              (* 0.0000001  
                 (apply '+  
                        (mapcar '(lambda (x)  
                                   (* (car x)  
                                      (sin (mod  
                                            (+ (car (cdr x))  
                                               (* (car (cdr (cdr x))) U))  
                                            (* 2 pi)))))  
                                solar-data-list)))))  
          (aberration  
           (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973)))  
          (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 pi)))  
          (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 pi)))  
          (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2))))))  
     (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0)))  
   
646  (defconst solar-data-list  (defconst solar-data-list
647    '((403406 4.721964 1.621043)    '((403406 4.721964 1.621043)
648      (195207 5.937458 62830.348067)      (195207 5.937458 62830.348067)
# Line 737  calendar-time-zone are used to interpret Line 695  calendar-time-zone are used to interpret
695      (10 1.50 21463.25)      (10 1.50 21463.25)
696      (10 2.55 157208.40)))      (10 2.55 157208.40)))
697    
698    (defun solar-longitude (d)
699      "Longitude of sun on astronomical (Julian) day number D.
700    Accurary is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes).
701    
702    The values of calendar-daylight-savings-starts,
703    calendar-daylight-savings-starts-time, calendar-daylight-savings-ends,
704    calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and
705    calendar-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)  (defun solar-ephemeris-correction (year)
741    "Ephemeris time minus Universal Time during Gregorian year.    "Ephemeris time minus Universal Time during Gregorian year.
742  Result is in days.  Result is in days.

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26