Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
2 changes: 2 additions & 0 deletions case_study_3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
case_study_3_reproducible_cache
case_study_3_additional_cache
161 changes: 161 additions & 0 deletions case_study_3/case_study_3_additional.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
title: "Additional exploration"
output: github_document
---

<!---# Source - https://stackoverflow.com/a
# Posted by Thomas
# Retrieved 2025-12-09, License - CC BY-SA 3.0 -->


First some code from the reproducible example is repeated to use the same time frame

```{r echo=FALSE}
knitr::opts_chunk$set(cache = TRUE)
invisible(knitr::purl("case_study_3_reproducable.Rmd", output="temp.R", quiet=TRUE))
knitr::read_chunk("temp.R")
```

```{r ref.label='requiredPkg'}
```
```{r ref.label='datetime'}
```

```{r echo=FALSE}
unlink("temp.R")
```
Lets take a bit wider interval to see the context


```{r interv}
small_scale_radar_interval<-lubridate::interval(time-hours(10), time+hours(10))
```
## Robin Radars located at sea

To investigate the high densities at sea we analyse two robin radars located there.

```{r uvaRR}
require(uvaRR)
trks <- purrr::map(
c("rws01", "borssele"),
~ rr_track(
database = .x,
ts =c(int_start(small_scale_radar_interval), int_end(small_scale_radar_interval)) ,
interv = 60 * 60,
geom = T,
classification = c("BIRD"),
movement_metrics = c("dir", "dist", "edist", "spd", "str", "z")
) |>
tibble::add_column(radar = .x)
) |>
bind_rows() |>
mutate(trajectory = sf::st_as_sfc(trajectory, crs = 4326)) |>
st_as_sf() |>
mutate(
radarid_unique = trajectory_radarid |>
purrr::map(
~ unlist(purrr::map(
purrr::map(strsplit(gsub("\\{|\\}", "", .x), ","), as.numeric),
unique
))
),
radarid_unique_chr = purrr::map_chr(
purrr::map(radarid_unique, as.character),
paste,
collapse = " "
),
radar_type = case_match(
radarid_unique_chr,
c("11 14", "5 8") ~ "mixed",
c("14", "8") ~ "vertical",
c("11", "5") ~ "horizontal"
)
)
```
There is an increased density of birds in Luchterduinen (`rws01`) while this is absent from Borssele.
```{r rrplot}
ggplot(trks) +
geom_histogram(aes(x = timestamp_start, fill = classification)) +
facet_grid(radar ~ .) +
geom_vline(xintercept = time)
ggplot(trks) +
geom_histogram(aes(x = timestamp_start, fill = radar_type)) +
facet_grid(radar ~ .) +
geom_vline(xintercept = time)
```
A directional histogram seems to confirm that the movements are vey directional corresponding to migratory movements
```{r dirhist}
ggplot(
trks |>
dplyr::filter(
radar_type != "vertical",
timestamp_start <
lubridate::ceiling_date(time + lubridate::hours(2), "hours"),
timestamp_start >
lubridate::floor_date(time - lubridate::hours(2), "hours")
)
) +
geom_histogram(aes(x = dir, fill = radar_type), binwidth = 30) +
facet_grid(radar ~ lubridate::floor_date(timestamp_start, "hour")) +
coord_polar() +
scale_x_continuous(limits = c(0, 360), breaks = 0:3*90)
```


## MR1 Radars


```{r mr1}
bs_radar_databases = c("sbrs_kid_bs291", "sbrs_ams_bs290")
bs_data <- purrr::map(
bs_radar_databases, ~
DBI::dbGetQuery(
as.is = F,
uvaAuth::get_connection_postgresql(.x),
glue::glue(
"select * from collection left join rf_classification on rf_classification.echo = collection.row
left join rfclasses on rfclasses.id = rf_classification.class where time_stamp between '{format(lubridate::int_start(small_scale_radar_interval))}' and '{format(lubridate::int_end(small_scale_radar_interval))}';
"
)
) |>
dplyr::mutate(
speed = feature3,
azimuth = feature2,
altitude_AGL = feature1
) %>%
dplyr::select(-starts_with("feature")) %>%
tibble::add_column(database = .x)
) |>
bind_rows()

```

```{r explore}
bs_data_filtered<-bs_data |> dplyr::filter(!name%in%c('insect', 'undefined', 'nonbio','precipitation'))
table(bs_data$name)

ggplot(bs_data_filtered) +
geom_histogram(aes(x = time_stamp, fill = name)) +
facet_grid(database ~ .) +
geom_vline(xintercept = time)
```

Here we see that the radar in Kijkduin has a migratory peak in the morning while that is absent from Amsterdam.

Lets explore the directions in Kijkduin:
```{r dirhistBs}
ggplot(
bs_data_filtered |>
dplyr::filter(
database=='sbrs_kid_bs291',
time_stamp <
lubridate::ceiling_date(time + lubridate::hours(2), "hours"),
time_stamp >
lubridate::floor_date(time - lubridate::hours(2), "hours")
)
) +
geom_histogram(aes(x = azimuth, fill = name), binwidth = 15) +
facet_wrap(. ~ lubridate::floor_date(time_stamp, "hour")) +
coord_polar() +
scale_x_continuous(limits = c(0, 360), breaks = 0:3*90)
```
Loading