lunar.phase {lunar} | R Documentation |
Lunar Phase
Description
Returns the lunar phase on specified dates.
Usage
lunar.phase(x, shift = 0, ..., name = FALSE)
Arguments
x |
A vector of |
shift |
The number of hours by which to shift the calculation of lunar phase. By default lunar phase is calculated at 12 noon UT. |
... |
Other optional arguments are ignored. |
name |
Optional parameter indicating whether the return is a factor variable
By default lunar phase is returned in radians.
If assigned the value 8, it returns a factor variable with
8 phase levels.
If |
Details
Adapted from function
moon.illumination
in from the
R4MFCL project (not an R package), which was developed
by the Secretariat of the Pacific Community (SPC).
The R4MFCL project was led by Simon Hoyle, and also includes code
by Shelton Harley, Nick Davies, and Adam Langley of the SPC,
and Pierre Kleiber of the US National Marine Fisheries Service.
Pierre Kleiber is the author of the
moon.illumination
function.
Code from project R4MFCL is distributed under the MIT License:
https://opensource.org/licenses/mit-license.php
Here is a link to the R4MFCL project:
https://code.google.com/archive/p/r4mfcl/
The R4MFCL code was modified as follows:
Changed function name from
moonphase
tolunar.phase
.Changed input date to be in
Date
format (as opposed toPOSIXct
).Removed reliance on other R4MFCL functions.
Changed name of primary input from
ptime
tox
.Added optional
shift
term (in hours) relative to 12h UT.Added optional
name
term to control whether phase names as opposed to radians should be returned.Changed the documentation.
Where radians are returned:
0 refers to the new moon
-
\pi/2
refers to the first quarter -
\pi
refers to the full moon -
3\pi/2
refers to the last quarter
Adapted originally from Stephen R. Schmitt: Sky & Telescope, Astronomical Computing, April 1994 and https://web.archive.org/web/20140716104947/http://mysite.verizon.net/res148h4j/zenosamples/zs_lunarphasecalc.html, which references Jean Meeus, Astronomical Algorithms. Willmann-Bell, Inc. (1991) 429p.
See Also
Examples
lunar.phase(as.Date("2013-05-06"))