unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nicholas Strauss <nicholas.strauss@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 20414@debbugs.gnu.org
Subject: bug#20414: Fwd: lunar.el
Date: Tue, 23 Feb 2016 14:01:47 -0800	[thread overview]
Message-ID: <CAAgRMM+_YVGqi_XyDyxU9KcFX0QaWnyhrnET1B0OSK8aR17Trg@mail.gmail.com> (raw)
In-Reply-To: <87k2lvso73.fsf@gnus.org>

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

Hi Lars,

The Calendar already computed Moon's latitude and longitude -- I was
just reuse for eclipses.

 The first right/wrong test is to determine if this is theoretically right.

    (if (or (= phase 0)
            (= phase 2))
        (cond ((< moon-lat 2.42600766e-1)
           (concat "** " phase-name " Eclipse **"))
              ((< moon-lat 0.37)
               (concat "** " phase-name " Eclipse possible **"))
              (t
               "")
              )


 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.

If you're interested, I can discuss where those magic numbers come from.

:0
Nick

On Tue, Feb 23, 2016 at 2:42 AM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Glenn Morris <rgm@gnu.org> writes:
>
>> Thanks for this.
>> What's the difference between "eclipse" and "eclipse possible"?
>>
>> It predicts eclipses when the moon is quarter-full, which seems wrong?
>>
>> Tuesday, June 9, 2015: Last Quarter Moon 8:48am (PDT) **  Eclipse possible **
>> Tuesday, June 16, 2015: New Moon 7:08am (PDT)
>> Wednesday, June 24, 2015: First Quarter Moon 4:04am (PDT) **  Eclipse **
>
> It seems like a fun addition to lunar.el, but if it's wrong, it's...
> not.  :-)
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

[-- Attachment #2: lunar-eclipses-2016-2116.txt --]
[-- Type: text/plain, Size: 21093 bytes --]

Monday, February 22, 2016: Full Moon 10:17am (PST) ** Lunar Eclipse possible **
Wednesday, March 23, 2016: Full Moon 4:58am (PDT) ** Lunar Eclipse **
Thursday, August 18, 2016: Full Moon 2:25am (PDT) ** Lunar Eclipse possible **
Friday, September 16, 2016: Full Moon 12:03pm (PDT) ** Lunar Eclipse possible **
Friday, February 10, 2017: Full Moon 4:30pm (PST) ** Lunar Eclipse **
Sunday, March 12, 2017: Full Moon 7:51am (PDT) ** Lunar Eclipse possible **
Monday, August 7, 2017: Full Moon 11:09am (PDT) ** Lunar Eclipse **
Wednesday, January 31, 2018: Full Moon 5:24am (PST) ** Lunar Eclipse **
Friday, July 27, 2018: Full Moon 1:18pm (PDT) ** Lunar Eclipse **
Sunday, January 20, 2019: Full Moon 9:13pm (PST) ** Lunar Eclipse **
Tuesday, July 16, 2019: Full Moon 2:35pm (PDT) ** Lunar Eclipse **
Wednesday, December 11, 2019: Full Moon 9:11pm (PST) ** Lunar Eclipse possible **
Friday, January 10, 2020: Full Moon 11:20am (PST) ** Lunar Eclipse **
Friday, June 5, 2020: Full Moon 12:08pm (PDT) ** Lunar Eclipse possible **
Saturday, July 4, 2020: Full Moon 9:40pm (PDT) ** Lunar Eclipse possible **
Monday, November 30, 2020: Full Moon 1:29am (PST) ** Lunar Eclipse **
Tuesday, December 29, 2020: Full Moon 7:27pm (PST) ** Lunar Eclipse possible **
Wednesday, May 26, 2021: Full Moon 4:10am (PDT) ** Lunar Eclipse **
Friday, November 19, 2021: Full Moon 12:56am (PST) ** Lunar Eclipse **
Sunday, May 15, 2022: Full Moon 9:11pm (PDT) ** Lunar Eclipse **
Tuesday, November 8, 2022: Full Moon 2:59am (PST) ** Lunar Eclipse **
Friday, May 5, 2023: Full Moon 10:32am (PDT) ** Lunar Eclipse **
Friday, September 29, 2023: Full Moon 2:54am (PDT) ** Lunar Eclipse possible **
Saturday, October 28, 2023: Full Moon 1:20pm (PDT) ** Lunar Eclipse **
Sunday, March 24, 2024: Full Moon 11:58pm (PDT) ** Lunar Eclipse **
Tuesday, April 23, 2024: Full Moon 4:47pm (PDT) ** Lunar Eclipse possible **
Tuesday, September 17, 2024: Full Moon 7:32pm (PDT) ** Lunar Eclipse **
Thursday, March 13, 2025: Full Moon 11:52pm (PDT) ** Lunar Eclipse **
Sunday, September 7, 2025: Full Moon 11:06am (PDT) ** Lunar Eclipse **
Tuesday, March 3, 2026: Full Moon 3:35am (PST) ** Lunar Eclipse **
Thursday, August 27, 2026: Full Moon 9:16pm (PDT) ** Lunar Eclipse **
Friday, January 22, 2027: Full Moon 4:15am (PST) ** Lunar Eclipse possible **
Saturday, February 20, 2027: Full Moon 3:20pm (PST) ** Lunar Eclipse **
Sunday, July 18, 2027: Full Moon 8:42am (PDT) ** Lunar Eclipse possible **
Tuesday, August 17, 2027: Full Moon 12:26am (PDT) ** Lunar Eclipse possible **
Tuesday, January 11, 2028: Full Moon 8:01pm (PST) ** Lunar Eclipse **
Thursday, February 10, 2028: Full Moon 7:01am (PST) ** Lunar Eclipse possible **
Thursday, July 6, 2028: Full Moon 11:08am (PDT) ** Lunar Eclipse **
Sunday, December 31, 2028: Full Moon 8:46am (PST) ** Lunar Eclipse **
Monday, June 25, 2029: Full Moon 8:18pm (PDT) ** Lunar Eclipse **
Thursday, December 20, 2029: Full Moon 2:45pm (PST) ** Lunar Eclipse **
Saturday, June 15, 2030: Full Moon 11:36am (PDT) ** Lunar Eclipse **
Saturday, November 9, 2030: Full Moon 7:28pm (PST) ** Lunar Eclipse possible **
Monday, December 9, 2030: Full Moon 2:39pm (PST) ** Lunar Eclipse **
Tuesday, May 6, 2031: Full Moon 8:37pm (PDT) ** Lunar Eclipse possible **
Thursday, June 5, 2031: Full Moon 4:55am (PDT) ** Lunar Eclipse possible **
Thursday, October 30, 2031: Full Moon 12:29am (PDT) ** Lunar Eclipse **
Friday, November 28, 2031: Full Moon 3:16pm (PST) ** Lunar Eclipse possible **
Sunday, April 25, 2032: Full Moon 8:08am (PDT) ** Lunar Eclipse **
Monday, October 18, 2032: Full Moon 11:55am (PDT) ** Lunar Eclipse **
Thursday, April 14, 2033: Full Moon 12:15pm (PDT) ** Lunar Eclipse **
Saturday, October 8, 2033: Full Moon 3:55am (PDT) ** Lunar Eclipse **
Saturday, March 4, 2034: Full Moon 6:08pm (PST) ** Lunar Eclipse possible **
Monday, April 3, 2034: Full Moon 12:16pm (PDT) ** Lunar Eclipse **
Tuesday, August 29, 2034: Full Moon 9:47am (PDT) ** Lunar Eclipse possible **
Wednesday, September 27, 2034: Full Moon 7:54pm (PDT) ** Lunar Eclipse **
Thursday, February 22, 2035: Full Moon 12:51am (PST) ** Lunar Eclipse **
Friday, March 23, 2035: Full Moon 3:39pm (PDT) ** Lunar Eclipse possible **
Saturday, August 18, 2035: Full Moon 5:58pm (PDT) ** Lunar Eclipse **
Monday, February 11, 2036: Full Moon 2:06pm (PST) ** Lunar Eclipse **
Wednesday, August 6, 2036: Full Moon 7:47pm (PDT) ** Lunar Eclipse **
Saturday, January 31, 2037: Full Moon 6:02am (PST) ** Lunar Eclipse **
Sunday, July 26, 2037: Full Moon 9:13pm (PDT) ** Lunar Eclipse **
Tuesday, December 22, 2037: Full Moon 5:38am (PST) ** Lunar Eclipse possible **
Wednesday, January 20, 2038: Full Moon 7:59pm (PST) ** Lunar Eclipse **
Wednesday, June 16, 2038: Full Moon 7:26pm (PDT) ** Lunar Eclipse possible **
Friday, July 16, 2038: Full Moon 4:44am (PDT) ** Lunar Eclipse possible **
Saturday, December 11, 2038: Full Moon 9:30am (PST) ** Lunar Eclipse **
Monday, January 10, 2039: Full Moon 3:45am (PST) ** Lunar Eclipse possible **
Monday, June 6, 2039: Full Moon 11:44am (PDT) ** Lunar Eclipse **
Wednesday, November 30, 2039: Full Moon 8:48am (PST) ** Lunar Eclipse **
Saturday, May 26, 2040: Full Moon 4:45am (PDT) ** Lunar Eclipse **
Sunday, November 18, 2040: Full Moon 11:03am (PST) ** Lunar Eclipse **
Wednesday, May 15, 2041: Full Moon 5:51pm (PDT) ** Lunar Eclipse **
Wednesday, October 9, 2041: Full Moon 10:59am (PDT) ** Lunar Eclipse possible **
Thursday, November 7, 2041: Full Moon 8:40pm (PST) ** Lunar Eclipse **
Saturday, April 5, 2042: Full Moon 7:14am (PDT) ** Lunar Eclipse possible **
Sunday, May 4, 2042: Full Moon 11:47pm (PDT) ** Lunar Eclipse possible **
Monday, September 29, 2042: Full Moon 3:32am (PDT) ** Lunar Eclipse **
Tuesday, October 28, 2042: Full Moon 12:46pm (PDT) ** Lunar Eclipse possible **
Wednesday, March 25, 2043: Full Moon 7:23am (PDT) ** Lunar Eclipse **
Friday, September 18, 2043: Full Moon 6:45pm (PDT) ** Lunar Eclipse **
Sunday, March 13, 2044: Full Moon 12:38pm (PDT) ** Lunar Eclipse **
Wednesday, September 7, 2044: Full Moon 4:22am (PDT) ** Lunar Eclipse **
Wednesday, February 1, 2045: Full Moon 1:03pm (PST) ** Lunar Eclipse possible **
Thursday, March 2, 2045: Full Moon 11:49pm (PST) ** Lunar Eclipse **
Friday, July 28, 2045: Full Moon 3:08pm (PDT) ** Lunar Eclipse possible **
Sunday, August 27, 2045: Full Moon 7:06am (PDT) ** Lunar Eclipse possible **
Monday, January 22, 2046: Full Moon 4:49am (PST) ** Lunar Eclipse **
Tuesday, February 20, 2046: Full Moon 3:42pm (PST) ** Lunar Eclipse possible **
Tuesday, July 17, 2046: Full Moon 5:51pm (PDT) ** Lunar Eclipse **
Friday, January 11, 2047: Full Moon 5:20pm (PST) ** Lunar Eclipse **
Sunday, July 7, 2047: Full Moon 3:29am (PDT) ** Lunar Eclipse **
Tuesday, December 31, 2047: Full Moon 10:56pm (PST) ** Lunar Eclipse **
Thursday, June 25, 2048: Full Moon 7:04pm (PDT) ** Lunar Eclipse **
Friday, November 20, 2048: Full Moon 3:18am (PST) ** Lunar Eclipse possible **
Saturday, December 19, 2048: Full Moon 10:38pm (PST) ** Lunar Eclipse **
Monday, May 17, 2049: Full Moon 4:12am (PDT) ** Lunar Eclipse possible **
Tuesday, June 15, 2049: Full Moon 12:24pm (PDT) ** Lunar Eclipse possible **
Tuesday, November 9, 2049: Full Moon 7:34am (PST) ** Lunar Eclipse **
Wednesday, December 8, 2049: Full Moon 11:25pm (PST) ** Lunar Eclipse possible **
Friday, May 6, 2050: Full Moon 3:25pm (PDT) ** Lunar Eclipse **
Saturday, October 29, 2050: Full Moon 8:12pm (PDT) ** Lunar Eclipse **
Tuesday, April 25, 2051: Full Moon 7:17pm (PDT) ** Lunar Eclipse **
Thursday, October 19, 2051: Full Moon 12:11pm (PDT) ** Lunar Eclipse **
Saturday, April 13, 2052: Full Moon 7:27pm (PDT) ** Lunar Eclipse **
Sunday, September 8, 2052: Full Moon 5:14pm (PDT) ** Lunar Eclipse possible **
Tuesday, October 8, 2052: Full Moon 3:52am (PDT) ** Lunar Eclipse **
Tuesday, March 4, 2053: Full Moon 9:07am (PST) ** Lunar Eclipse **
Wednesday, April 2, 2053: Full Moon 11:20pm (PDT) ** Lunar Eclipse possible **
Friday, August 29, 2053: Full Moon 12:51am (PDT) ** Lunar Eclipse **
Saturday, February 21, 2054: Full Moon 10:44pm (PST) ** Lunar Eclipse **
Tuesday, August 18, 2054: Full Moon 2:20am (PDT) ** Lunar Eclipse **
Thursday, February 11, 2055: Full Moon 2:46pm (PST) ** Lunar Eclipse **
Saturday, August 7, 2055: Full Moon 3:55am (PDT) ** Lunar Eclipse **
Sunday, January 2, 2056: Full Moon 2:05pm (PST) ** Lunar Eclipse possible **
Tuesday, February 1, 2056: Full Moon 4:34am (PST) ** Lunar Eclipse **
Tuesday, June 27, 2056: Full Moon 2:44am (PDT) ** Lunar Eclipse possible **
Wednesday, July 26, 2056: Full Moon 11:51am (PDT) ** Lunar Eclipse possible **
Thursday, December 21, 2056: Full Moon 5:34pm (PST) ** Lunar Eclipse **
Saturday, January 20, 2057: Full Moon 12:01pm (PST) ** Lunar Eclipse possible **
Saturday, June 16, 2057: Full Moon 7:15pm (PDT) ** Lunar Eclipse **
Monday, December 10, 2057: Full Moon 4:45pm (PST) ** Lunar Eclipse **
Thursday, June 6, 2058: Full Moon 12:13pm (PDT) ** Lunar Eclipse **
Friday, November 29, 2058: Full Moon 7:15pm (PST) ** Lunar Eclipse **
Tuesday, May 27, 2059: Full Moon 1:02am (PDT) ** Lunar Eclipse **
Monday, October 20, 2059: Full Moon 7:13pm (PDT) ** Lunar Eclipse possible **
Wednesday, November 19, 2059: Full Moon 5:07am (PST) ** Lunar Eclipse **
Thursday, April 15, 2060: Full Moon 2:20pm (PDT) ** Lunar Eclipse possible **
Saturday, May 15, 2060: Full Moon 6:38am (PDT) ** Lunar Eclipse possible **
Saturday, October 9, 2060: Full Moon 11:39am (PDT) ** Lunar Eclipse **
Sunday, November 7, 2060: Full Moon 8:15pm (PST) ** Lunar Eclipse possible **
Monday, April 4, 2061: Full Moon 2:46pm (PDT) ** Lunar Eclipse **
Thursday, September 29, 2061: Full Moon 2:31am (PDT) ** Lunar Eclipse **
Friday, March 24, 2062: Full Moon 8:33pm (PDT) ** Lunar Eclipse **
Monday, September 18, 2062: Full Moon 11:35am (PDT) ** Lunar Eclipse **
Monday, February 12, 2063: Full Moon 9:47pm (PST) ** Lunar Eclipse possible **
Wednesday, March 14, 2063: Full Moon 9:11am (PDT) ** Lunar Eclipse **
Wednesday, August 8, 2063: Full Moon 9:38pm (PDT) ** Lunar Eclipse possible **
Friday, September 7, 2063: Full Moon 1:52pm (PDT) ** Lunar Eclipse **
Saturday, February 2, 2064: Full Moon 1:35pm (PST) ** Lunar Eclipse **
Monday, March 3, 2064: Full Moon 12:16am (PST) ** Lunar Eclipse possible **
Monday, July 28, 2064: Full Moon 12:38am (PDT) ** Lunar Eclipse **
Thursday, January 22, 2065: Full Moon 1:52am (PST) ** Lunar Eclipse **
Friday, July 17, 2065: Full Moon 10:41am (PDT) ** Lunar Eclipse **
Monday, January 11, 2066: Full Moon 7:06am (PST) ** Lunar Eclipse **
Wednesday, July 7, 2066: Full Moon 2:31am (PDT) ** Lunar Eclipse **
Wednesday, December 1, 2066: Full Moon 11:15am (PST) ** Lunar Eclipse possible **
Friday, December 31, 2066: Full Moon 6:39am (PST) ** Lunar Eclipse **
Saturday, May 28, 2067: Full Moon 11:40am (PDT) ** Lunar Eclipse possible **
Sunday, June 26, 2067: Full Moon 7:50pm (PDT) ** Lunar Eclipse possible **
Sunday, November 20, 2067: Full Moon 3:47pm (PST) ** Lunar Eclipse **
Tuesday, December 20, 2067: Full Moon 7:40am (PST) ** Lunar Eclipse possible **
Wednesday, May 16, 2068: Full Moon 10:33pm (PDT) ** Lunar Eclipse **
Friday, November 9, 2068: Full Moon 3:38am (PST) ** Lunar Eclipse **
Monday, May 6, 2069: Full Moon 2:09am (PDT) ** Lunar Eclipse **
Tuesday, October 29, 2069: Full Moon 8:34pm (PDT) ** Lunar Eclipse **
Friday, April 25, 2070: Full Moon 2:29am (PDT) ** Lunar Eclipse **
Saturday, September 20, 2070: Full Moon 12:46am (PDT) ** Lunar Eclipse possible **
Sunday, October 19, 2070: Full Moon 11:57am (PDT) ** Lunar Eclipse **
Sunday, March 15, 2071: Full Moon 6:16pm (PDT) ** Lunar Eclipse possible **
Tuesday, April 14, 2071: Full Moon 6:54am (PDT) ** Lunar Eclipse possible **
Wednesday, September 9, 2071: Full Moon 7:50am (PDT) ** Lunar Eclipse **
Thursday, October 8, 2071: Full Moon 10:22pm (PDT) ** Lunar Eclipse possible **
Friday, March 4, 2072: Full Moon 7:15am (PST) ** Lunar Eclipse **
Sunday, August 28, 2072: Full Moon 8:58am (PDT) ** Lunar Eclipse **
Tuesday, February 21, 2073: Full Moon 11:25pm (PST) ** Lunar Eclipse **
Thursday, August 17, 2073: Full Moon 10:43am (PDT) ** Lunar Eclipse **
Friday, January 12, 2074: Full Moon 10:31pm (PST) ** Lunar Eclipse possible **
Sunday, February 11, 2074: Full Moon 1:05pm (PST) ** Lunar Eclipse **
Sunday, July 8, 2074: Full Moon 10:02am (PDT) ** Lunar Eclipse possible **
Monday, August 6, 2074: Full Moon 7:03pm (PDT) ** Lunar Eclipse possible **
Wednesday, January 2, 2075: Full Moon 1:39am (PST) ** Lunar Eclipse **
Thursday, January 31, 2075: Full Moon 8:13pm (PST) ** Lunar Eclipse possible **
Friday, June 28, 2075: Full Moon 2:44am (PDT) ** Lunar Eclipse **
Sunday, December 22, 2075: Full Moon 12:47am (PST) ** Lunar Eclipse **
Tuesday, June 16, 2076: Full Moon 7:37pm (PDT) ** Lunar Eclipse **
Thursday, December 10, 2076: Full Moon 3:33am (PST) ** Lunar Eclipse **
Sunday, June 6, 2077: Full Moon 8:07am (PDT) ** Lunar Eclipse **
Sunday, October 31, 2077: Full Moon 3:35am (PDT) ** Lunar Eclipse possible **
Monday, November 29, 2077: Full Moon 1:41pm (PST) ** Lunar Eclipse **
Tuesday, April 26, 2078: Full Moon 9:17pm (PDT) ** Lunar Eclipse possible **
Thursday, May 26, 2078: Full Moon 1:21pm (PDT) ** Lunar Eclipse possible **
Thursday, October 20, 2078: Full Moon 7:54pm (PDT) ** Lunar Eclipse **
Saturday, November 19, 2078: Full Moon 4:52am (PST) ** Lunar Eclipse possible **
Saturday, April 15, 2079: Full Moon 10:01pm (PDT) ** Lunar Eclipse **
Tuesday, October 10, 2079: Full Moon 10:23am (PDT) ** Lunar Eclipse **
Thursday, April 4, 2080: Full Moon 4:22am (PDT) ** Lunar Eclipse **
Saturday, September 28, 2080: Full Moon 6:54pm (PDT) ** Lunar Eclipse **
Monday, March 24, 2081: Full Moon 5:27pm (PDT) ** Lunar Eclipse **
Tuesday, August 19, 2081: Full Moon 4:14am (PDT) ** Lunar Eclipse possible **
Wednesday, September 17, 2081: Full Moon 8:45pm (PDT) ** Lunar Eclipse **
Thursday, February 12, 2082: Full Moon 10:16pm (PST) ** Lunar Eclipse **
Saturday, March 14, 2082: Full Moon 9:44am (PDT) ** Lunar Eclipse possible **
Saturday, August 8, 2082: Full Moon 7:30am (PDT) ** Lunar Eclipse **
Tuesday, February 2, 2083: Full Moon 10:21am (PST) ** Lunar Eclipse **
Wednesday, July 28, 2083: Full Moon 5:57pm (PDT) ** Lunar Eclipse **
Saturday, January 22, 2084: Full Moon 3:15pm (PST) ** Lunar Eclipse **
Monday, July 17, 2084: Full Moon 9:59am (PDT) ** Lunar Eclipse **
Monday, December 11, 2084: Full Moon 7:18pm (PST) ** Lunar Eclipse possible **
Wednesday, January 10, 2085: Full Moon 2:42pm (PST) ** Lunar Eclipse **
Thursday, June 7, 2085: Full Moon 7:01pm (PDT) ** Lunar Eclipse possible **
Saturday, July 7, 2085: Full Moon 3:13am (PDT) ** Lunar Eclipse possible **
Saturday, December 1, 2085: Full Moon 12:08am (PST) ** Lunar Eclipse **
Sunday, December 30, 2085: Full Moon 3:58pm (PST) ** Lunar Eclipse possible **
Tuesday, May 28, 2086: Full Moon 5:34am (PDT) ** Lunar Eclipse **
Wednesday, November 20, 2086: Full Moon 12:10pm (PST) ** Lunar Eclipse **
Saturday, May 17, 2087: Full Moon 8:54am (PDT) ** Lunar Eclipse **
Monday, November 10, 2087: Full Moon 4:04am (PST) ** Lunar Eclipse **
Wednesday, May 5, 2088: Full Moon 9:24am (PDT) ** Lunar Eclipse **
Thursday, September 30, 2088: Full Moon 8:25am (PDT) ** Lunar Eclipse possible **
Friday, October 29, 2088: Full Moon 8:09pm (PDT) ** Lunar Eclipse **
Saturday, March 26, 2089: Full Moon 2:18am (PDT) ** Lunar Eclipse possible **
Sunday, April 24, 2089: Full Moon 2:21pm (PDT) ** Lunar Eclipse possible **
Monday, September 19, 2089: Full Moon 2:55pm (PDT) ** Lunar Eclipse **
Wednesday, October 19, 2089: Full Moon 6:03am (PDT) ** Lunar Eclipse possible **
Wednesday, March 15, 2090: Full Moon 4:40pm (PDT) ** Lunar Eclipse **
Friday, September 8, 2090: Full Moon 3:44pm (PDT) ** Lunar Eclipse **
Monday, March 5, 2091: Full Moon 7:57am (PST) ** Lunar Eclipse **
Tuesday, August 28, 2091: Full Moon 5:38pm (PDT) ** Lunar Eclipse **
Thursday, January 24, 2092: Full Moon 6:55am (PST) ** Lunar Eclipse possible **
Friday, February 22, 2092: Full Moon 9:30pm (PST) ** Lunar Eclipse **
Friday, July 18, 2092: Full Moon 5:22pm (PDT) ** Lunar Eclipse possible **
Sunday, August 17, 2092: Full Moon 2:20am (PDT) ** Lunar Eclipse **
Monday, January 12, 2093: Full Moon 9:44am (PST) ** Lunar Eclipse **
Wednesday, February 11, 2093: Full Moon 4:19am (PST) ** Lunar Eclipse possible **
Wednesday, July 8, 2093: Full Moon 10:12am (PDT) ** Lunar Eclipse **
Friday, January 1, 2094: Full Moon 8:52am (PST) ** Lunar Eclipse **
Monday, June 28, 2094: Full Moon 2:58am (PDT) ** Lunar Eclipse **
Tuesday, December 21, 2094: Full Moon 11:56am (PST) ** Lunar Eclipse **
Friday, June 17, 2095: Full Moon 3:05pm (PDT) ** Lunar Eclipse **
Friday, November 11, 2095: Full Moon 11:04am (PST) ** Lunar Eclipse possible **
Saturday, December 10, 2095: Full Moon 10:20pm (PST) ** Lunar Eclipse **
Monday, May 7, 2096: Full Moon 4:06am (PDT) ** Lunar Eclipse possible **
Tuesday, June 5, 2096: Full Moon 7:58pm (PDT) ** Lunar Eclipse possible **
Wednesday, October 31, 2096: Full Moon 4:16am (PDT) ** Lunar Eclipse **
Thursday, November 29, 2096: Full Moon 1:34pm (PST) ** Lunar Eclipse possible **
Friday, April 26, 2097: Full Moon 5:09am (PDT) ** Lunar Eclipse **
Sunday, October 20, 2097: Full Moon 6:22pm (PDT) ** Lunar Eclipse **
Tuesday, April 15, 2098: Full Moon 12:03pm (PDT) ** Lunar Eclipse **
Friday, October 10, 2098: Full Moon 2:20am (PDT) ** Lunar Eclipse **
Sunday, April 5, 2099: Full Moon 1:35am (PDT) ** Lunar Eclipse **
Sunday, August 30, 2099: Full Moon 10:55am (PDT) ** Lunar Eclipse possible **
Tuesday, September 29, 2099: Full Moon 3:46am (PDT) ** Lunar Eclipse **
Wednesday, February 24, 2100: Full Moon 6:51am (PST) ** Lunar Eclipse **
Thursday, March 25, 2100: Full Moon 6:04pm (PDT) ** Lunar Eclipse possible **
Thursday, August 19, 2100: Full Moon 2:28pm (PDT) ** Lunar Eclipse **
Saturday, September 18, 2100: Full Moon 4:31am (PDT) ** Lunar Eclipse possible **
Sunday, February 13, 2101: Full Moon 6:43pm (PST) ** Lunar Eclipse **
Tuesday, August 9, 2101: Full Moon 1:17am (PDT) ** Lunar Eclipse **
Thursday, February 2, 2102: Full Moon 11:19pm (PST) ** Lunar Eclipse **
Saturday, July 29, 2102: Full Moon 5:28pm (PDT) ** Lunar Eclipse **
Sunday, December 24, 2102: Full Moon 3:25am (PST) ** Lunar Eclipse possible **
Monday, January 22, 2103: Full Moon 10:43pm (PST) ** Lunar Eclipse **
Wednesday, June 20, 2103: Full Moon 2:18am (PDT) ** Lunar Eclipse possible **
Thursday, July 19, 2103: Full Moon 10:37am (PDT) ** Lunar Eclipse possible **
Thursday, December 13, 2103: Full Moon 8:34am (PST) ** Lunar Eclipse **
Saturday, January 12, 2104: Full Moon 12:17am (PST) ** Lunar Eclipse possible **
Sunday, June 8, 2104: Full Moon 12:28pm (PDT) ** Lunar Eclipse **
Monday, December 1, 2104: Full Moon 8:49pm (PST) ** Lunar Eclipse **
Thursday, May 28, 2105: Full Moon 3:31pm (PDT) ** Lunar Eclipse **
Saturday, November 21, 2105: Full Moon 12:40pm (PST) ** Lunar Eclipse **
Monday, May 17, 2106: Full Moon 4:13pm (PDT) ** Lunar Eclipse **
Tuesday, October 12, 2106: Full Moon 4:10pm (PDT) ** Lunar Eclipse possible **
Thursday, November 11, 2106: Full Moon 3:28am (PST) ** Lunar Eclipse **
Thursday, April 7, 2107: Full Moon 10:14am (PDT) ** Lunar Eclipse possible **
Friday, May 6, 2107: Full Moon 9:42pm (PDT) ** Lunar Eclipse possible **
Saturday, October 1, 2107: Full Moon 10:06pm (PDT) ** Lunar Eclipse **
Monday, October 31, 2107: Full Moon 1:51pm (PDT) ** Lunar Eclipse possible **
Tuesday, March 27, 2108: Full Moon 12:58am (PDT) ** Lunar Eclipse **
Wednesday, September 19, 2108: Full Moon 10:38pm (PDT) ** Lunar Eclipse **
Saturday, March 16, 2109: Full Moon 5:22pm (PDT) ** Lunar Eclipse **
Monday, September 9, 2109: Full Moon 12:41am (PDT) ** Lunar Eclipse **
Thursday, March 6, 2110: Full Moon 5:46am (PST) ** Lunar Eclipse **
Thursday, July 31, 2110: Full Moon 12:44am (PDT) ** Lunar Eclipse possible **
Friday, August 29, 2110: Full Moon 9:44am (PDT) ** Lunar Eclipse **
Saturday, January 24, 2111: Full Moon 5:47pm (PST) ** Lunar Eclipse **
Monday, February 23, 2111: Full Moon 12:19pm (PST) ** Lunar Eclipse possible **
Monday, July 20, 2111: Full Moon 5:41pm (PDT) ** Lunar Eclipse **
Wednesday, January 13, 2112: Full Moon 4:57pm (PST) ** Lunar Eclipse **
Saturday, July 9, 2112: Full Moon 10:16am (PDT) ** Lunar Eclipse **
Sunday, January 1, 2113: Full Moon 8:21pm (PST) ** Lunar Eclipse **
Wednesday, June 28, 2113: Full Moon 10:00pm (PDT) ** Lunar Eclipse **
Wednesday, November 22, 2113: Full Moon 7:41pm (PST) ** Lunar Eclipse possible **
Friday, December 22, 2113: Full Moon 7:04am (PST) ** Lunar Eclipse **
Saturday, May 19, 2114: Full Moon 10:48am (PDT) ** Lunar Eclipse possible **
Monday, June 18, 2114: Full Moon 2:30am (PDT) ** Lunar Eclipse possible **
Monday, November 12, 2114: Full Moon 11:45am (PST) ** Lunar Eclipse **
Tuesday, December 11, 2114: Full Moon 10:20pm (PST) ** Lunar Eclipse possible **
Wednesday, May 8, 2115: Full Moon 12:10pm (PDT) ** Lunar Eclipse **
Saturday, November 2, 2115: Full Moon 2:29am (PDT) ** Lunar Eclipse **

[-- Attachment #3: lunar.el.ncs --]
[-- Type: application/octet-stream, Size: 19054 bytes --]

;;; lunar.el --- calendar functions for phases of the moon

;; Copyright (C) 1992-1993, 1995, 1997, 2001-2015 Free Software
;; Foundation, Inc.

;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
;; Maintainer: Glenn Morris <rgm@gnu.org>
;; Keywords: calendar
;; Human-Keywords: moon, lunar phases, calendar, diary
;; Package: calendar

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; See calendar.el.

;; Based on ``Astronomical Formulae for Calculators,'' 3rd ed., by Jean Meeus,
;; Willmann-Bell, Inc., 1985 and ``Astronomical Algorithms'' by Jean Meeus,
;; Willmann-Bell, Inc., 1991.
;;
;; WARNING: The calculations will be accurate only to within a few minutes.

;; The author would be delighted to have an astronomically more sophisticated
;; person rewrite the code for the lunar calculations in this file!

;;; Code:

(require 'calendar)
(require 'solar)
(require 'cal-dst)
;; calendar-astro-to-absolute and v versa are cal-autoloads.
;;;(require 'cal-julian)

(defcustom lunar-phase-names
  '("New Moon" "First Quarter Moon" "Full Moon" "Last Quarter Moon")
  "List of names for the lunar phases."
  :type '(list
          (string :tag "New Moon")
          (string :tag "First Quarter Moon")
          (string :tag "Full Moon")
          (string :tag "Last Quarter Moon"))
  :group 'calendar
  :version "23.2")

(defun lunar-phase (index)
  "Local date and time of lunar phase INDEX.
Integer below INDEX/4 gives the lunation number, counting from Jan 1, 1900;
remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon,
3 last quarter.  Returns a list (DATE TIME PHASE)."
  (let* ((phase (mod index 4))
         (index (/ index 4.0))
         (time (/ index 1236.85))
         (date (+ (calendar-absolute-from-gregorian '(1 0.5 1900))
                  0.75933
                  (* 29.53058868 index) ; FIXME 29.530588853?
                  (* 0.0001178 time time)
                  (* -0.000000155 time time time)
                  (* 0.00033
                     (solar-sin-degrees (+ 166.56
                                           (* 132.87 time)
                                           (* -0.009173 time time))))))
         (sun-anomaly (mod
                       (+ 359.2242
                          (* 29.105356 index)
                          (* -0.0000333 time time)
                          (* -0.00000347 time time time))
                       360.0))
         (moon-anomaly (mod
                        (+ 306.0253
                           (* 385.81691806 index)
                           (* 0.0107306 time time)
                           (* 0.00001236 time time time))
                        360.0))
         (moon-lat (mod
                    (+ 21.2964
                       (* 390.67050646 index)
                       (* -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))
                    (solar-sin-degrees sun-anomaly))
                 (* 0.0021 (solar-sin-degrees (* 2 sun-anomaly)))
                 (* -0.4068 (solar-sin-degrees moon-anomaly))
                 (* 0.0161 (solar-sin-degrees (* 2 moon-anomaly)))
                 (* -0.0004 (solar-sin-degrees (* 3 moon-anomaly)))
                 (* 0.0104 (solar-sin-degrees (* 2 moon-lat)))
                 (* -0.0051 (solar-sin-degrees (+ sun-anomaly moon-anomaly)))
                 (* -0.0074 (solar-sin-degrees (- sun-anomaly moon-anomaly)))
                 (* 0.0004 (solar-sin-degrees (+ (* 2 moon-lat) sun-anomaly)))
                 (* -0.0004 (solar-sin-degrees (- (* 2 moon-lat) sun-anomaly)))
                 (* -0.0006 (solar-sin-degrees
                             (+ (* 2 moon-lat) moon-anomaly)))
                 (* 0.0010 (solar-sin-degrees (- (* 2 moon-lat) moon-anomaly)))
                 (* 0.0005 (solar-sin-degrees
                            (+ (* 2 moon-anomaly) sun-anomaly))))
            (+ (* (- 0.1721 (* 0.0004 time))
                  (solar-sin-degrees sun-anomaly))
               (* 0.0021 (solar-sin-degrees (* 2 sun-anomaly)))
               (* -0.6280 (solar-sin-degrees moon-anomaly))
               (* 0.0089 (solar-sin-degrees (* 2 moon-anomaly)))
               (* -0.0004 (solar-sin-degrees (* 3 moon-anomaly)))
               (* 0.0079 (solar-sin-degrees (* 2 moon-lat)))
               (* -0.0119 (solar-sin-degrees (+ sun-anomaly moon-anomaly)))
               (* -0.0047 (solar-sin-degrees (- sun-anomaly moon-anomaly)))
               (* 0.0003 (solar-sin-degrees (+ (* 2 moon-lat) sun-anomaly)))
               (* -0.0004 (solar-sin-degrees (- (* 2 moon-lat) sun-anomaly)))
               (* -0.0006 (solar-sin-degrees (+ (* 2 moon-lat) moon-anomaly)))
               (* 0.0021 (solar-sin-degrees (- (* 2 moon-lat) moon-anomaly)))
               (* 0.0003 (solar-sin-degrees
                          (+ (* 2 moon-anomaly) sun-anomaly)))
               (* 0.0004 (solar-sin-degrees
                          (- sun-anomaly (* 2 moon-anomaly))))
               (* -0.0003 (solar-sin-degrees
                           (+ (* 2 sun-anomaly) moon-anomaly))))))
         (adj (+ 0.0028
                 (* -0.0004 (solar-cosine-degrees
                             sun-anomaly))
                 (* 0.0003 (solar-cosine-degrees
                            moon-anomaly))))
         (adjustment (cond ((= phase 1) (+ adjustment adj))
                           ((= phase 2) (- adjustment adj))
                           (t adjustment)))
         (date (+ date adjustment))
         (date (+ date (/ (- calendar-time-zone
                             (solar-ephemeris-correction
                              (calendar-extract-year
                               (calendar-gregorian-from-absolute
                                (truncate date)))))
                          60.0 24.0)))
         (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 eclipse)))

;; from "Astronomy with your Personal Computer",
;; Subroutine Eclipse Line 7000
;; Peter Duffett-Smith Cambridge University Press 1990
;; -ncs klas Thu Apr 23 14:34:12 PDT 2015
(defun eclipse-check (moon-lat phase)
  (let*
      ((M_PI                        3.1415926535)
       (moon-lat (* (/ M_PI 180)
		    moon-lat))
       (moon-lat (abs (- moon-lat
			 (*
			  (floor
			   (/ moon-lat 
			      M_PI)
			   )
			  M_PI)
			 )
		      )
		 )
       (moon-lat (cond ((> moon-lat 0.37) (- M_PI moon-lat))
		       (t moon-lat)))
       (phase-name (cond ((= phase 0) "Solar")
                         ((= phase 2) "Lunar")
                         (t ""))))
    (if (or (= phase 0)
	    (= phase 2))
	(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.")

;; FIXME new-moon index; use in lunar-phase-list implies always below.
(defun lunar-index (date)
  "Return the lunar index for Gregorian date DATE.
This is 4 times the approximate number of new moons since 1 Jan 1900.
The factor of 4 allows (mod INDEX 4) to represent the four quarters."
  (* 4 (truncate
        (* lunar-cycles-per-year
           ;; Years since 1900, as a real.
           (+ (calendar-extract-year date)
              (/ (calendar-day-number date) 366.0)
              -1900)))))

(defun lunar-phase-list (month year)
  "List of lunar phases for three months starting with Gregorian MONTH, YEAR."
  (let* ((index (lunar-index (list month 1 year)))
         (new-moon (lunar-phase index))
         (end-date (let ((end-month month)
                         (end-year (+ 100 year)))
                     (calendar-increment-month end-month end-year 3)
                     (list (list end-month 1 end-year))))
         ;; Alternative for start-date:
;;;         (calendar-gregorian-from-absolute
;;;          (1- (calendar-absolute-from-gregorian (list month 1 year))))
         (start-date (progn
                       (calendar-increment-month month year -1)
                       (list (list month
                                   (calendar-last-day-of-month month year)
                                   year))))
         list)
    (while (calendar-date-compare new-moon end-date)
      (if (calendar-date-compare start-date new-moon)
          (setq list (append list (list new-moon))))
      (setq index (1+ index)
            new-moon (lunar-phase index)))
    list))

(defun lunar-phase-name (phase)
  "Name of lunar PHASE.
0 = new moon, 1 = first quarter, 2 = full moon, 3 = last quarter."
  (nth phase lunar-phase-names))

(defvar displayed-month)                ; from calendar-generate
(defvar displayed-year)

;;;###cal-autoload
(defun calendar-lunar-phases (&optional event)
  "Create a buffer with the lunar phases for the current calendar window.
If EVENT is non-nil, it's an event indicating the buffer position to
use instead of point."
  (interactive (list last-nonmenu-event))
  ;; If called from a menu, with the calendar window not selected.
  (with-current-buffer
      (if event (window-buffer (posn-window (event-start event)))
        (current-buffer))
    (message "Computing phases of the moon...")
    (let ((m1 displayed-month)
          (y1 displayed-year)
          (m2 displayed-month)
          (y2 (+ 100 displayed-year) ))
      (calendar-increment-month m1 y1 -1)
      (calendar-increment-month m2 y2 1)
      (calendar-in-read-only-buffer lunar-phases-buffer
        (calendar-set-mode-line
         (if (= y1 y2)
             (format "Phases of the Moon from %s to %s, %d%%-"
                     (calendar-month-name m1) (calendar-month-name m2) y2)
           (format "Phases of the Moon from %s, %d to %s, %d%%-"
                   (calendar-month-name m1) y1 (calendar-month-name m2) y2)))
        (insert
         (mapconcat
          (lambda (x)
            (format "%s: %s %s %s" (calendar-date-string (car x))
                    (lunar-phase-name (nth 2 x))
                    (cadr x)
		    (car (last x))
		    ))
          (lunar-phase-list m1 y1) "\n")))
      (message "Computing phases of the moon...done"))))

;;;###autoload
(defun lunar-phases (&optional arg)
  "Display the quarters of the moon for last month, this month, and next month.
If called with an optional prefix argument ARG, prompts for month and year.
This function is suitable for execution in an init file."
  (interactive "P")
  (save-excursion
    (let* ((date (if arg (calendar-read-date t)
                   (calendar-current-date)))
           (displayed-month (calendar-extract-month date))
           (displayed-year (calendar-extract-year date)))
      (calendar-lunar-phases))))

(defvar date)

;; To be called from diary-list-sexp-entries, where DATE is bound.

;;;###diary-autoload
(defun diary-lunar-phases (&optional mark)
  "Moon phases diary entry.
An optional parameter MARK specifies a face or single-character string to
use when highlighting the day in the calendar."
  (let* ((index (lunar-index date))
         (phase (lunar-phase index)))
    (while (calendar-date-compare phase (list date))
      (setq index (1+ index)
            phase (lunar-phase index)))
    (if (calendar-date-equal (car phase) date)
        (cons mark (concat (lunar-phase-name (nth 2 phase)) " "
                           (cadr phase))))))

;; For the Chinese calendar the calculations for the new moon need to be more
;; accurate than those above, so we use more terms in the approximation.
(defun lunar-new-moon-time (k)
  "Astronomical (Julian) day number of K th new moon."
  (let* ((T (/ k 1236.85))
         (T2 (* T T))
         (T3 (* T T T))
         (T4 (* T2 T2))
         (JDE (+ 2451550.09765
                 (* 29.530588853 k)
                 (* 0.0001337 T2)
                 (* -0.000000150 T3)
                 (* 0.00000000073 T4)))
         (E (- 1 (* 0.002516 T) (* 0.0000074 T2)))
         (sun-anomaly (+ 2.5534
                         (* 29.10535669 k)
                         (* -0.0000218 T2)
                         (* -0.00000011 T3)))
         (moon-anomaly (+ 201.5643
                          (* 385.81693528 k)
                          (* 0.0107438 T2)
                          (* 0.00001239 T3)
                          (* -0.000000058 T4)))
         (moon-argument (+ 160.7108
                           (* 390.67050274 k)
                           (* -0.0016341 T2)
                           (* -0.00000227 T3)
                           (* 0.000000011 T4)))
         (omega (+ 124.7746
                   (* -1.56375580 k)
                   (* 0.0020691 T2)
                   (* 0.00000215 T3)))
         (A1  (+ 299.77 (*  0.107408 k) (* -0.009173 T2)))
         (A2  (+ 251.88 (*  0.016321 k)))
         (A3  (+ 251.83 (* 26.641886 k)))
         (A4  (+ 349.42 (* 36.412478 k)))
         (A5  (+  84.66 (* 18.206239 k)))
         (A6  (+ 141.74 (* 53.303771 k)))
         (A7  (+ 207.14 (*  2.453732 k)))
         (A8  (+ 154.84 (*  7.306860 k)))
         (A9  (+  34.52 (* 27.261239 k)))
         (A10 (+ 207.19 (*  0.121824 k)))
         (A11 (+ 291.34 (*  1.844379 k)))
         (A12 (+ 161.72 (* 24.198154 k)))
         (A13 (+ 239.56 (* 25.513099 k)))
         (A14 (+ 331.55 (*  3.592518 k)))
         (correction
          (+ (* -0.40720   (solar-sin-degrees moon-anomaly))
             (*  0.17241 E (solar-sin-degrees sun-anomaly))
             (*  0.01608   (solar-sin-degrees (* 2 moon-anomaly)))
             (*  0.01039   (solar-sin-degrees (* 2 moon-argument)))
             (*  0.00739 E (solar-sin-degrees (- moon-anomaly sun-anomaly)))
             (* -0.00514 E (solar-sin-degrees (+ moon-anomaly sun-anomaly)))
             (*  0.00208 E E (solar-sin-degrees (* 2 sun-anomaly)))
             (* -0.00111   (solar-sin-degrees
                            (- moon-anomaly (* 2 moon-argument))))
             (* -0.00057   (solar-sin-degrees
                            (+ moon-anomaly (* 2 moon-argument))))
             (*  0.00056 E (solar-sin-degrees
                            (+ (* 2 moon-anomaly) sun-anomaly)))
             (* -0.00042   (solar-sin-degrees (* 3 moon-anomaly)))
             (*  0.00042 E (solar-sin-degrees
                            (+ sun-anomaly (* 2 moon-argument))))
             (*  0.00038 E (solar-sin-degrees
                            (- sun-anomaly (* 2 moon-argument))))
             (* -0.00024 E (solar-sin-degrees
                            (- (* 2 moon-anomaly) sun-anomaly)))
             (* -0.00017   (solar-sin-degrees omega))
             (* -0.00007   (solar-sin-degrees
                            (+ moon-anomaly (* 2 sun-anomaly))))
             (*  0.00004   (solar-sin-degrees
                            (- (* 2 moon-anomaly) (* 2 moon-argument))))
             (*  0.00004   (solar-sin-degrees (* 3 sun-anomaly)))
             (*  0.00003   (solar-sin-degrees (+ moon-anomaly sun-anomaly
                                                 (* -2 moon-argument))))
             (*  0.00003   (solar-sin-degrees
                            (+ (* 2 moon-anomaly) (* 2 moon-argument))))
             (* -0.00003   (solar-sin-degrees (+ moon-anomaly sun-anomaly
                                                 (* 2 moon-argument))))
             (*  0.00003   (solar-sin-degrees (- moon-anomaly sun-anomaly
                                                 (* -2 moon-argument))))
             (* -0.00002   (solar-sin-degrees (- moon-anomaly sun-anomaly
                                                 (* 2 moon-argument))))
             (* -0.00002   (solar-sin-degrees
                            (+ (* 3 moon-anomaly) sun-anomaly)))
             (*  0.00002   (solar-sin-degrees (* 4 moon-anomaly)))))
         (additional
          (+ (* 0.000325 (solar-sin-degrees A1))
             (* 0.000165 (solar-sin-degrees A2))
             (* 0.000164 (solar-sin-degrees A3))
             (* 0.000126 (solar-sin-degrees A4))
             (* 0.000110 (solar-sin-degrees A5))
             (* 0.000062 (solar-sin-degrees A6))
             (* 0.000060 (solar-sin-degrees A7))
             (* 0.000056 (solar-sin-degrees A8))
             (* 0.000047 (solar-sin-degrees A9))
             (* 0.000042 (solar-sin-degrees A10))
             (* 0.000040 (solar-sin-degrees A11))
             (* 0.000037 (solar-sin-degrees A12))
             (* 0.000035 (solar-sin-degrees A13))
             (* 0.000023 (solar-sin-degrees A14))))
         (newJDE (+ JDE correction additional)))
    (+ newJDE
       (- (solar-ephemeris-correction
           (calendar-extract-year
            (calendar-gregorian-from-absolute
             (floor (calendar-astro-to-absolute newJDE))))))
       (/ calendar-time-zone 60.0 24.0))))

(defun lunar-new-moon-on-or-after (d)
  "Julian day number of first new moon on or after Julian day number D.
The fractional part is the time of day.

The date and time are local time, including any daylight saving rules,
as governed by 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'."
  (let* ((date (calendar-gregorian-from-absolute
                (floor (calendar-astro-to-absolute d))))
         (year (+ (calendar-extract-year date)
                  (/ (calendar-day-number date) 365.25)))
         (k (floor (* (- year 2000.0) lunar-cycles-per-year)))
         (date (lunar-new-moon-time k))
         (a-date (progn
                   (while (< date d)
                     (setq k (1+ k)
                           date (lunar-new-moon-time k)))
                   (calendar-astro-to-absolute date)))
         (time (* 24 (- a-date (truncate a-date))))
         (date (calendar-gregorian-from-absolute (truncate a-date)))
         (adj (dst-adjust-time date time)))
    (calendar-astro-from-absolute
     (+ (calendar-absolute-from-gregorian (car adj))
        (/ (cadr adj) 24.0)))))

(provide 'lunar)

;;; lunar.el ends here

  reply	other threads:[~2016-02-23 22:01 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 [this message]
2019-06-25 17:31           ` Lars Ingebrigtsen
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAAgRMM+_YVGqi_XyDyxU9KcFX0QaWnyhrnET1B0OSK8aR17Trg@mail.gmail.com \
    --to=nicholas.strauss@gmail.com \
    --cc=20414@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).