View source: R/create-suntimes.R
create_suntimes_rsts | R Documentation |
Generate a list of two multi-layer SpatRasters for a given template that
indicate sunrise and sunset for the respective cells.
The package suncalc
is required to use this function.
create_suntimes_rsts(
template,
dates = terra::time(template),
crs = "EPSG:4258",
tz = Sys.timezone(),
.quiet = FALSE
)
template |
(Multi-layer) SpatRaster that determines the spatial extent of the result. |
dates |
Dates that should be processed. If not specified, the dates of
|
crs |
Coordinate reference system with longitude/latitude metrics. It is used to project the raster coordinates to be able to retrieve longitude and latitude. |
tz |
Timezone of the results. |
.quiet |
If |
A list with the elements sunrise
and sunset
which are
both multi-layer SpatRasters. The values indicate the respective time in
minutes. Each layer represents one date.
create_suntimes_df()
# calculate suntimes, use barrks_data()$tmin as template
st <- create_suntimes_rsts(barrks_data()[[1]], .quiet = TRUE)
# plot results on May 1st, 2015
terra::plot(st$sunrise[[terra::time(st$sunrise) == '2015-05-01']])
terra::plot(st$sunset[[terra::time(st$sunset) == '2015-05-01']])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.