#example für Tübingen, Germany
coordinates <- c(48.521637, 9.057645)
dates <- c("2023-06-01", "2025-08-23")
tz <- "Europe/Berlin"
#civil dawn/dusk
photoperiod(coordinates, dates, tz)
#sunrise/sunset
photoperiod(coordinates, dates, tz, solarDep = 0)
#extract_photoperiod
sample.data.environment |>
extract_photoperiod(coordinates)
#add_photoperiod
added_photoperiod <-
sample.data.environment |>
add_photoperiod(coordinates)
added_photoperiod |> head()
added_photoperiod |>
filter_Date(length = "3 days") |>
gg_days(aes_col = photoperiod.state,
group = dplyr::consecutive_id(photoperiod.state),
jco_color = TRUE
)
added_photoperiod |>
filter_Date(length = "3 days") |>
gg_day(aes_col = Id) +
ggplot2:: geom_rect(
data = \(x) x |> dplyr::ungroup(Id) |> dplyr::summarize(dawn = mean(dawn) |> hms::as_hms()),
ggplot2::aes(xmin = 0, xmax = dawn, ymin = -Inf, ymax = Inf),
alpha = 0.1
) +
ggplot2:: geom_rect(
data = \(x) x |> dplyr::ungroup(Id) |> dplyr::summarize(dusk = mean(dusk) |> hms::as_hms()),
ggplot2::aes(xmin = dusk, xmax = 24*60*60, ymin = -Inf, ymax = Inf),
alpha = 0.1
)
added_photoperiod |> dplyr::summarize(dawn = mean(dawn) |> hms::as_hms())
#solar_noon()
solar_noon(coordinates, dates, tz)
Run the code above in your browser using DataLab