# Moon Calculator

Version 1.1

Moon Calculator was created to tell me what days the Moon would be in prime picture taking position. Initially, I had it set up to tell me what days the Moon would be 30 degrees above the horizon between Nautical Twilight in the evening and Civil Twilight in the morning. To do this, I combined a number of routines I found on the web to generate a chart of which days fit the criteria. I am using routines to calculate the times of twilight (evening and morning), the position of the moon at a given time, and routines for calculating the illumination and age of the Moon at a given time. I have generalized the chart generating to allow for a user defined location, user selected twilight times (astronomical, nautical, civil), and user defined minimum altitude.

#### Installing and running Moon Calculator:

1. Make sure you have a Java runtime that is at least version 1.3.1 or greater: http://java.sun.com/getjava/download.html
3. Run the batch file MoonCalculator.bat.

The current defaults generate times for Seattle, WA between Nautical Twilight and Civil Twilight when the Moon is above 30 degrees. To change these, go to Tools\Options... in the menus. Currently, you will need to enter your latitude and longitude in order to generate the chart for your location. You can find this at http://www.heavens-above.com if you don't know it.

#### Methodology:

The general process for generating the chart is as follows: I iterate over the minutes starting from Midnight of the Start Date through the number of days chosen, skipping over the hours when the sun is above the chosen values (if selected). A row is generated for each interval that the moon is visible (within the criteria selected). The Best View is a bit subjective. I try to select the time when the Moon is at it's highest point during full dark. If this isn't possible, then I choose the highest point after sunset and before sunrise. The phase and age are calculated for the Best View time.

#### Column definitions:

• Date: The local date that the visible times begin.
• Begin: The local time that the Moon rises above the minimum height and the Sun is below the "Set Value".
• End: The local time that the Moon goes below the minimum height and the Sun is above the "Rise Value".
• Start: The altitude of the Moon at the Begin time.
• High: The highest altitude of the Moon during the visible time span.
• End: The altitude of the Moon at the End time.
• Best View: The time that the Moon's view is the best.
• Degree at Best: The altitude of the Moon at it's best view.
• Phase: This is actually percent illumination of the Moon's face.
• Age: The number of days since the previous new moon.

#### Sources:

The routines I am currently using to generate the chart in Moon Calculator can be found in the following packages:

• MoonTool by John Walker (Used to calculate the illumination and age of the moon). I ported the phase calculation routines to Java.
• SunTimes Java Classes by Kevin Boone/Web-Tomorrow (Used to calculate the various sun times)
• BANDA Java Packages (I can no longer find a website carrying this, but it is available in the MoonCalc.zip) by B.W. Bush (Used to calculate the altitude of the Moon at a given time.)

#### Known issues:

• Since I am iterating over the minutes of each day and running the calculation of the Moon's altitude for each minute, it can take a while to generate the chart. There may be optimizations I could do, but so far I don't mind the time it takes since I only run it about once a month.

#### Revision History:

1.1:

• Fixed one-off error that caused lockup when starting calculation process in December.

1.0:

• First Release