lunar-phases

2025-06-22

Approximated calculation of moon phases.

Upstream URL

Author

cage

Maintainer

cage

License

LLGPL, MIT
README
This simple library implements a method to calculate the lunar phase at a given moment in time.

The calculation is illustrated in:

"Practical Astronomy with your Calculator or Spreadsheet"

Peter Duffett-Smith, Jonathan Zwart, Cambridge University Press 2011

https://doi.org/10.1017/CBO9780511861161

This package exports a method,

  • lunar-phase:gregorian->julian-date

and a function

  • lunar-phase:lunar-phase.

The first one is specialized on local-time:timestamp and converts Gregorian calendar time to a time measurement units suitable for astronomical calculation.

The second one takes, as single argument, a Julian date, and returns the fraction of illuminated moon at given time.

In summary to calculate the lunar phase at 2025-02-12:

  (:use-package :lunar-phase)

  (lunar-phase (gregorian->julian-date (local-timet:encode-timestamp 0 0 0 0 12 2 2025))) ; 0.997, full moon

1important Note

The implemented method is approximated, useful only for didactic purposes or for entertainment.

2LICENSE

This software is Copyright © cage.

The authors grant you the rights to distribute and use this software as governed by the terms of the Lisp Lesser GNU Public License (http://opensource.franz.com/preamble.html), known as the LLGPL.

This program 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.

Dependencies (3)

  • alexandria
  • clunit2
  • local-time

Dependents (0)

    • GitHub
    • Quicklisp