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
) this information is extracted from the
bioRad object directly.
check_night(x, ..., elev = -0.268)# S3 method for default
check_night(x, lon, lat, ..., tz = "UTC", elev = -0.268)
# S3 method for vp
check_night(x, ..., elev = -0.268)
# S3 method for list
check_night(x, ..., elev = -0.268)
# S3 method for vpts
check_night(x, ..., elev = -0.268)
# S3 method for pvol
check_night(x, ..., elev = -0.268)
pvol
, vp
or vpts
,
or a date inheriting from class POSIXct
or a string
interpretable by as.POSIXct.
optional lat,lon arguments.
numeric. Sun elevation in degrees.
numeric. Longitude in decimal degrees.
numeric. Latitude in decimal degrees.
character. Time zone. Ignored when date
already has an associated time zone
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.
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.
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.
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab