1 Preparation

sessionInfo()
## R version 4.2.0 (2022-04-22)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Red Hat Enterprise Linux 8.8 (Ootpa)
## 
## Matrix products: default
## BLAS:   /sw/pkgs/arc/stacks/gcc/10.3.0/R/4.2.0/lib64/R/lib/libRblas.so
## LAPACK: /sw/pkgs/arc/stacks/gcc/10.3.0/R/4.2.0/lib64/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] bookdown_0.30    digest_0.6.30    R6_2.5.1         jsonlite_1.8.3  
##  [5] magrittr_2.0.3   evaluate_0.18    stringi_1.7.8    rlang_1.1.1     
##  [9] cli_3.6.1        rstudioapi_0.13  jquerylib_0.1.4  bslib_0.3.1     
## [13] rmarkdown_2.14   tools_4.2.0      stringr_1.4.1    xfun_0.35       
## [17] yaml_2.3.6       rsconnect_0.8.29 fastmap_1.1.0    compiler_4.2.0  
## [21] htmltools_0.5.5  knitr_1.41       sass_0.4.1
if (!requireNamespace("pacman", quietly = TRUE)) install.packages("pacman")
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")

# List of required packages
required_packages <- c(
  "broom", "cowplot", "doSNOW", "dotenv", "foreach", "geosphere", "ggpubr", "ggrepel", "ggspatial", "ggthemes", "imputeTS", "knitr", "lmerTest", "lubridate", "magick", "mclust", "parallel", "patchwork", "ptw", "rnpn", "rsconnect", "scales", "sf", "shiny", "taxize", "terra", "tidyverse"
)

# Identify missing packages
missing_packages <- setdiff(required_packages, rownames(installed.packages()))

# Install if there are missing packages
if (length(missing_packages) > 0) {
  pacman::p_install(missing_packages)
} else {
  message("All required packages are already installed. Skipping installation.")
}

# Check and install tidynab from GitHub
if (!requireNamespace("tidynab", quietly = TRUE)) {
  devtools::install_github("zhulabgroup/tidynab")
}

pacman::p_load("tidyverse")
pacman::p_load("sf")
pacman::p_load("parallel")
pacman::p_load("doSNOW")
pacman::p_load("patchwork")

source("code/util_whit.R")
source("code/util_extend_ts.R")
.deploy_shiny <- T
.fig_save <- T
.path <- list(
  out_fig = "figures/",
  nab = "data/nab/",
  occ = "data/occurrence/",
  neon = "data/neon/",
  dat_other = "data/processed/",
  npn = "data/npn/",
  ps = "data/ps/",
  res = "data/results/"
)

Taxa of interest are based on 1) Lo et al.,2019 (Description and allergenic potential of 11 most important pollen taxa in the CUSSC region ranked by percent abundance relative to the sum of all pollen taxa over 31 NAB stations that meet inclusion criteria, 2003–2017) and 2) Crimmins et al., 2023. Spring- and fall-flowering elms are treated separately as suggested by Allison and Yingxiao.

v_taxa <- c("Acer", "Alnus", "Betula", "Carya", "Celtis", "Fraxinus", "Juglans", "Liquidambar", "Morus", "Platanus", "Populus", "Quercus", "Salix", "Ulmus early", "Ulmus late")
v_taxa_short <- str_split(v_taxa, pattern = " ", simplify = T)[, 1]

Focus on the life cycles from 2018 to 2022, spanning 2017 and 2023. This is because of the availability of PlanetScope data.

v_year <- 2018:2022