getMoonIllumination: Get Moon illumination

View source: R/getMoonIllumination.R

getMoonIlluminationR Documentation

Get Moon illumination

Description

Get Moon illumination

Usage

getMoonIllumination(date = Sys.Date(), keep = c("fraction", "phase", "angle"))

Arguments

date

Single or multiple DateTime. Can be a Date (YYYY-MM-DD), a character in UTC (YYYY-MM-DD HH:mm:ss) or a POSIXct

keep

character. Vector of variables to keep. See Details

Details

Computes the following properties:

"fraction"

illuminated fraction of the moon; varies from 0.0 (new moon) to 1.0 (full moon)

"phase"

moon phase; varies from 0.0 to 1.0, described below

"angle"

midpoint angle in radians of the illuminated limb of the moon reckoned eastward from the north point of the disk; the moon is waxing if the angle is negative, and waning if positive

Moon phase value should be interpreted like this:

0 New Moon
Waxing Crescent
0.25 First Quarter
Waxing Gibbous
0.5 Full Moon
Waning Gibbous
0.75 Last Quarter
Waning Crescent
1 New Moon

By subtracting the parallacticAngle from the angle one can get the zenith angle of the moons bright limb (anticlockwise). The zenith angle can be used do draw the moon shape from the observers perspective (e.g. moon lying on its back).

Value

data.frame

See Also

Other suncalc functions: getMoonPosition(), getMoonTimes(), getSunlightPosition(), getSunlightTimes()

Examples


# one date
getMoonIllumination(date = Sys.Date())

# in character
getMoonIllumination(date = c("2017-05-12", "2017-05-12 00:00:00"), 
  keep = c("fraction", "phase"))

# in POSIXct
getMoonIllumination(date = as.POSIXct("2017-05-12 00:00:00", tz = "UTC"))
getMoonIllumination(date = as.POSIXct("2017-05-12 02:00:00", tz = "CET"))

date <- seq(ISOdate(2009,1,1), ISOdate(2010,1,1), "hours")
date_cet <- date
attr(date_cet, "tzone") <- "CET"
res <- getMoonIllumination(date = date_cet)
      

suncalc documentation built on July 16, 2026, 5:06 p.m.