The Moons Calendar Implementation

The original implementation of this calendar was produced in 1975 hand drawn on brown wrapping paper. Another version was drawn on a drum plotter driven by an IBM 1130 running an ephemeris coded on punched cards in FORTRAN. Both of these showed the new, full, and quarter moons, and the quarter moons were drawn backwards, as was only noticed and reported by Joan's father. The illuminated limb, the circular, lit edge of the moon, is always closer to the sun than the dark limb. This original calendar was printed in the college printshop in black on grey, hand colored with white pencil, and sold in the cafeteria.

Another version was produced around 1999 using an ephemeris coded in C and loaded into Tcl/Tk as an extension.

The current version is an exercise in open standards browser programming. All the computations for the calendar are performed in your browser in Ecmascript, the standardization of Javascript by ECMA. The graphical depiction of the calendar is done using SVG, the structured vector graphics language defined by the World Wide Web Consortium.

The javascript sources for the Moons calendar consist of emphemerides.js for computing the positions of the sun, moon, and planets, ephemimages.js for computing the moon image painted for each phase, parse_search.js for handling the parsing of the window.location.search string to fetch parameters, and generate.js to organize the calculations and produce the SVG graphics for the calendar.

The ephemeris is taken from Paul Schlyter's low precision ephemeris, where you should go for a more detailed explanation. This computation is good to 1-2 arc minutes accuracy, and that accuracy is good for some period of years around 2000.

> The moon image generates a sequence of points to outline the illuminated part of the moon for a given separation from the sun in degrees along the ecliptic.

The window.location.search parser takes the string containing the search part of the url, which looks like this "?vw=1024&vh=480&d=40", and parses it into a javascript object as {vw: 1024, vh: 480, d: 40}. Other details are also handled, such as aliasing abbreviated names into longer names, restricting the acceptable set of names, supplying default values, and converting strings to the correct type.

The calendar generator takes a start date, a window size, a number of days width, a number of months height and arranges to draw a calendar. There are several other partially or completely unimplemented options in the source code.

This code is copyright © 2006 by Roger E Critchlow Jr, Santa Fe, New Mexico, USA.

This program 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 2 of the License, or (at your option) any later version.

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.

A copy of the GNU General Public License may be found at: gnu.org.

The Moons Calendar is Copyright © 2006,2009 by Roger E Critchlow Jr, Santa Fe, New Mexico, USA. All rights reserved. Permission granted for reproduction for personal or educational use.