View source: R/lunar.package.R
lunar.phase | R Documentation |
Returns the lunar phase on specified dates.
lunar.phase(x, shift = 0, ..., name = FALSE)
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 |
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
to lunar.phase
.
Changed input date to be in Date
format
(as opposed to POSIXct
).
Removed reliance on other R4MFCL functions.
Changed name of primary input from ptime
to x
.
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
π/2 refers to the first quarter
π refers to the full moon
3π/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.
lunar.4phases
lunar.8phases
lunar.phase(as.Date("2013-05-06"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.