all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Nicholas Strauss <nicholas.strauss@gmail.com>
Cc: 20414@debbugs.gnu.org
Subject: bug#20414: Fwd: lunar.el
Date: Tue, 25 Jun 2019 19:31:41 +0200	[thread overview]
Message-ID: <m3blyl4lmq.fsf@gnus.org> (raw)
In-Reply-To: <CAAgRMM+_YVGqi_XyDyxU9KcFX0QaWnyhrnET1B0OSK8aR17Trg@mail.gmail.com> (Nicholas Strauss's message of "Tue, 23 Feb 2016 14:01:47 -0800")

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

Nicholas Strauss <nicholas.strauss@gmail.com> writes:

>  2nd test is to compare predictions --  100 years run (modify
> emacs/lisp/calendar/lunar.el)
> NASA web page ( http://eclipse.gsfc.nasa.gov/LEdecade/LEdecade2011.html )
>
> I'm attaching my mutated lunar.el and a 100 year table.

Sounds great.  I was going to apply your patch (after changing it
coding-standards-wise slightly), but then I saw that you didn't have
copyright papers on file.  (I thought I remembered your name, but it was
a different Strauss.)

The change is big enough that a copyright assignment to the Free
Software Foundation is needed -- would you be willing to sign such
paperwork?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: lunar.diff --]
[-- Type: text/x-diff, Size: 2149 bytes --]

diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 1cdcc97f36..e3336fde8e 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -91,6 +91,7 @@ lunar-phase
                        (* -0.0016528 time time)
                        (* -0.00000239 time time time))
                     360.0))
+	 (eclipse (eclipse-check moon-lat phase))
          (adjustment
           (if (memq phase '(0 2))
               (+ (* (- 0.1734 (* 0.000393 time))
@@ -146,7 +147,25 @@ lunar-phase
          (time (* 24 (- date (truncate date))))
          (date (calendar-gregorian-from-absolute (truncate date)))
          (adj (dst-adjust-time date time)))
-    (list (car adj) (apply 'solar-time-string (cdr adj)) phase)))
+    (list (car adj) (apply 'solar-time-string (cdr adj)) phase eclipse)))
+
+;; from "Astronomy with your Personal Computer", Subroutine Eclipse
+;; Line 7000 Peter Duffett-Smith Cambridge University Press 1990
+(defun eclipse-check (moon-lat phase)
+  (let* ((moon-lat (* (/ math-pi 180) moon-lat))
+         (moon-lat (abs (- moon-lat (* (floor (/ moon-lat math-pi)) math-pi))))
+         (moon-lat (if (> moon-lat 0.37)
+                       (- math-pi moon-lat)
+                     moon-lat))
+         (phase-name (cond ((= phase 0) "Solar")
+                           ((= phase 2) "Lunar")
+                           (t ""))))
+    (cond ((< moon-lat 2.42600766e-1)
+	   (concat "** " phase-name " Eclipse **"))
+	  ((< moon-lat 0.37)
+	   (concat "** " phase-name " Eclipse possible **"))
+	  (t
+	   ""))))
 
 (defconst lunar-cycles-per-year 12.3685 ; 365.25/29.530588853
   "Mean number of lunar cycles per 365.25 day year.")
@@ -222,9 +241,10 @@ calendar-lunar-phases
         (insert
          (mapconcat
           (lambda (x)
-            (format "%s: %s %s" (calendar-date-string (car x))
+            (format "%s: %s %s %s" (calendar-date-string (car x))
                     (lunar-phase-name (nth 2 x))
-                    (cadr x)))
+                    (cadr x)
+		    (car (last x))))
           (lunar-phase-list m1 y1) "\n")))
       (message "Computing phases of the moon...done"))))
 

  reply	other threads:[~2019-06-25 17:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAAgRMM+uqHGmxv_UXW48ojUcGZyP36r+H+rTHh6Q5uVinMgQKQ@mail.gmail.com>
     [not found] ` <21817.15485.26346.312873@gnu.org>
2015-04-23 22:04   ` bug#20414: Fwd: lunar.el Nicholas Strauss
2015-05-18  7:01     ` Glenn Morris
     [not found]       ` <CAAgRMMLDW09SUhpkCgh+5ovmBhBGN0Oq5-y-cO_FZyuRGcmwPA@mail.gmail.com>
2015-05-18 18:20         ` bug#20606: Fwd: " Nicholas Strauss
2016-04-08 18:09           ` Marcin Borkowski
2016-02-23 10:42       ` Lars Ingebrigtsen
2016-02-23 22:01         ` Nicholas Strauss
2019-06-25 17:31           ` Lars Ingebrigtsen [this message]
2020-01-20 21:12             ` Stefan Kangas
2020-01-20 23:03               ` Stefan Kangas
2020-01-21  3:33                 ` Eli Zaretskii
2020-01-22 14:14                   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3blyl4lmq.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=20414@debbugs.gnu.org \
    --cc=nicholas.strauss@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.