moon phases

The illuminated fraction of the moon can be calculated with moonAngle() in the oce package, as illustrated graphically and in R code below; the labelled line is the time of full moon according to an almanac.

Exercises. (a) Try this for other locations. (b) Detect full moon by using uniroot() on the rate of change of illumination.

moon

library(oce)
par(mar=c(3, 3, 1, 1), mgp=c(2, 0.7, 0)) # tighten margins
t <- as.POSIXct("2013-12-1", tz="UTC") + seq(0, 28*24*3600, 3600)
f <- moonAngle(t=t, longitude=-63.6, 
                    latitude=44.65)$illuminatedFraction
plot(t, f, type="l", xlab="Day of 2013", ylab="Moon fraction")
grid()
## Time indicated is from an almanac
full <- as.POSIXct("2013-12-17 05:29:00", tz="AST")
abline(v=full)
mtext("full", at=full, side=3)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s