here() starts at /mnt/s1/projects/ecocast/projects/jellyscape
Salpsae
= "Salps"
thisgroup = read_ecomon_spp(form = 'sf', groups = thisgroup, agg = FALSE) |>
x ecomon_to_long() |>
::mutate(year = format(date, "%Y") ,
dplyrmonth = factor(format(date, "%b"), levels = month.abb))
= dplyr::filter(x, value > 0)
nonz = dplyr::filter(x, value <= 0)
zero = nrow(x)
n = zero |> nrow()
nz = sf::st_crop(coast, x) coast
There are 32693 records for salps
of which 23202 are zeroes (about 70.97%) leaving 9491 non-zero salp abundance records.
1 Non-zero abundances
Here’s an abudnance scaled plot of the non-zero abundances.
Code
plot(nonz['value'],
pch = ".",
logz = TRUE,
main = glue::glue("Non-zero abundance of {thisgroup}"),
axes = TRUE,
reset = FALSE)
plot(coast, add = TRUE, col = "black")
Code
ggplot(data = dplyr::group_by(nonz, year),
mapping = aes(x = year)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(y = "Record count", title = glue::glue("Non-zero abundance {thisgroup} Records by Year"))
Code
ggplot(data = dplyr::group_by(nonz, month),
mapping = aes(x = month)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(y = "Record count", title = glue::glue("Non-zero abundance {thisgroup} Records by Month"))
2 Zero Abundance (i.e. absences)
The distribution of zero abundance records is much more extensive.
Code
plot(zero['value'] |>
::filter(value <= 0) |>
dplyr::st_geometry(),
sfpch = ".",
main = glue::glue("Zero abundance presences {thisgroup}"),
axes = TRUE,
reset = FALSE)
plot(coast, add = TRUE, col = "black")
Code
ggplot(data = dplyr::group_by(zero, year),
mapping = aes(x = year)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(y = "Record count", title = glue::glue("Zero abundance {thisgroup} Records by Year"))
Code
ggplot(data = dplyr::group_by(zero, month),
mapping = aes(x = month)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(y = "Record count", title = glue::glue("Zero abudnance {thisgroup} Records by Month"))
3 A closer look at non-zero abundances
We can bin the data into abundance quantiles.
= seq(from = 0, to = 0.95, by = 0.05)
quants = quantile(nonz$value, quants)
qs = findInterval(nonz$value, qs)
ix = dplyr::mutate(nonz,
nonz quantile = quants[ix],
percentile = factor(names(qs)[ix], levels = names(qs)))
Code
ggplot(data = nonz) +
geom_sf(alpha = 0.1, size = 0.3) +
geom_sf(data = coast,
color = "orange") +
facet_wrap(~percentile)
4 A closer look at the top 5% abundances
Code
= dplyr::filter(nonz, quantile >= 0.95)
top5
ggplot(data = top5) +
geom_sf(alpha = 0.1, size = 0.4) +
geom_sf(data = coast,
color = "orange") +
facet_wrap(~month, drop = FALSE)