Sites

This page describes all sites and plots coordinates preparation and visualization.

Code
sites %>%
  mutate(plot = as.character(plot)) %>%
  unnest(plot) %>%
  filter(site == "Iwokrama") %>%
  select(
    plot,
    `Location (WGS UTM 21N) SW corners...5`,
    `Location (WGS UTM 21N) SW corners...6`
  ) %>%
  rename(
    lat = `Location (WGS UTM 21N) SW corners...5`,
    lon = `Location (WGS UTM 21N) SW corners...6`
  ) %>%
  sf::st_as_sf(coords = c("lat", "lon"), crs = "EPSG:32621") %>%
  sf::st_transform(4326) %>%
  sf::st_coordinates() %>%
  as_data_frame() %>%
  write_tsv("test.tsv")
Code
library(googlesheets4)
site_names <- read_sheet("https://docs.google.com/spreadsheets/d/1fq2owxMBLBwwibcdw2uQQFxnIhsMbaH4Qcj_xUwVvSQ/edit?usp=sharing", 2) %>% #nolint
  separate_rows(site_raw, sep = ",")
sites <- googlesheets4::read_sheet("https://docs.google.com/spreadsheets/d/1fq2owxMBLBwwibcdw2uQQFxnIhsMbaH4Qcj_xUwVvSQ/edit?gid=0#gid=0") %>% # nolint
  mutate(plot = as.character(plot)) %>%
  unnest(plot) %>%
  select(site, plot, latitude, longitude) %>%
  mutate(latitude = ifelse(site == "Kibale", 0.45, latitude)) %>%
  mutate(longitude = ifelse(site == "Kibale", 30.25, longitude)) %>%
  rename(site_raw = site) %>%
  left_join(site_names) %>%
  select(site, plot, latitude, longitude) %>%
  na.omit() %>%
  write_tsv("data/derived_data/sites.tsv")

We obtained the following sites and plots distribution globally.

Code
read_tsv("data/derived_data/sites.tsv") %>%
  st_as_sf(coords = c("longitude", "latitude"), crs = 4326) %>%
  leaflet() %>%
  addTiles() %>%
  addProviderTiles("Esri.WorldImagery", group = "ESRI") %>%
  addMarkers(
    label = ~ paste(site, plot),
    labelOptions = labelOptions(noHide = FALSE)
  )

Sites and plots locations.

Most sites showed a small dispersion of plots covering up 10 km2 at the exception of BAFOG & Sao Nicolau covering tenth of km2 and Iwokrama covering more than 150 km2 .

Code
read_tsv("data/derived_data/sites.tsv") %>%
  st_as_sf(coords = c("longitude", "latitude"), crs = 4326) %>%
  group_by(site) %>%
  summarise(n = n()) %>%
  st_convex_hull() %>%
  mutate(area = as.numeric(set_units(st_area(.), "km^2"))) %>%
  st_drop_geometry() %>%
  ggplot(aes(n, area)) +
  geom_point() +
  theme_bw() +
  xlab("Number of plots") +
  ylab(expression(paste("Area [", km^2, "]"))) +
  ggrepel::geom_text_repel(aes(label = site), size = 2) +
  scale_y_sqrt() +
  scale_x_log10()

Number of sites and total plots surface.
Code
sites <- read_tsv("data/derived_data/sites.tsv") %>% 
  group_by(site) %>% 
  select(-plot) %>% 
  summarise_all(mean)
if(!file.exists("data/derived_data/site"))
  dir.create("data/derived_data/site")
for (s in sites$site) {
  file <- file.path("data/derived_data/site",
                    paste0(s, ".tsv"))
  if(!file.exists(file)) {
    print(paste0("Writting ", s))
    sites %>% 
    filter(site == s) %>% 
    write_tsv(file)
  } else {
    print(paste0("Skipping ", s, ", file already exists."))
  }
}
paste0("sites: [", paste0('"', sites$site, '"', collapse = ", "), "]") %>% cat()