| check_night | R Documentation |
Checks if it is night (TRUE/FALSE) for a combination of
latitude, longitude, date and sun elevation. When used on a bioRad object
(pvol, vp, vpts, vpi) this information is extracted from the
bioRad object directly.
check_night(x, ..., elev = -0.268, offset = 0)
## Default S3 method:
check_night(x, lon, lat, ..., tz = "UTC", elev = -0.268, offset = 0)
## S3 method for class 'vp'
check_night(x, ..., elev = -0.268, offset = 0)
## S3 method for class 'list'
check_night(x, ..., elev = -0.268, offset = 0)
## S3 method for class 'vpts'
check_night(x, ..., elev = -0.268, offset = 0)
## S3 method for class 'vpi'
check_night(x, ..., elev = -0.268, offset = 0)
## S3 method for class 'pvol'
check_night(x, ..., elev = -0.268, offset = 0)
x |
A |
... |
Optional lat, lon arguments. |
elev |
Numeric (vector). Sun elevation in degrees defining nighttime. May also be a numeric vector of length two, with first element giving sunset elevation, and second element sunrise elevation. |
offset |
Numeric (vector). Time duration in seconds by which to shift the start and end of nighttime. May also be a numeric vector of length two, with first element added to moment of sunset and second element added to moment of sunrise. |
lon |
Numeric. Longitude, in decimal degrees. |
lat |
Numeric. Latitude, in decimal degrees. |
tz |
Character. Time zone. Ignored when |
check_night() evaluates to FALSE when the sun has a higher
elevation than parameter elev, otherwise TRUE.
Approximate astronomical formula are used, therefore the day/night transition may be off by a few minutes.
The angular diameter of the sun is about 0.536 degrees, therefore the moment of sunrise/sunset corresponds to half that elevation at -0.268 degrees. Approximate astronomical formula are used, therefore the day/night transition may be off by a few minutes.
offset can be used to shift the moment of sunset and sunrise by a temporal
offset, for example, offset = c(600,-900) will assume nighttime starts 600
seconds after sunset (as defined by elev) and stops 900 seconds before
sunrise.
TRUE when night, FALSE when day, NA if unknown
(either datetime or geographic location missing). For vpts a
vector of TRUE/FALSE values is returned.
# Check if it is night at UTC midnight in the Netherlands on January 1st:
check_night("2016-01-01 00:00", 5, 53)
# Check on bioRad objects directly:
check_night(example_vp)
check_night(example_vpts)
# Select nighttime profiles that are between 3 hours after sunset
# and 2 hours before sunrise:
index <- check_night(example_vpts, offset = c(3,-2)*3600)
example_vpts[index]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.