Data

library(dplyr)
library(tidyr)
library(ggplot2)
library(rsofun)
library(here)
library(lubridate)

Read nice file from FluxDataKit. This contains meteorological data, remotely sensed LAI and fAPAR, and observations-based GPP from an extended set of FLUXNET sites.

path_forcingfile <- "~/data/FluxDataKit/rsofun_driver_data_clean.rds"
driver <- readRDS(path_forcingfile)

# some simulations failed due to missing values in the forcing. If that happens,
# the number of rows in the output data is 1.
driver <- driver |>
  mutate(len = purrr::map_int(forcing, ~nrow(.))) |>
  filter(len >= 1095) |> # at least 3 years data
  select(-len)

Model run

Run the P-model (rsofun package) assuming 400 ppm for all sites and dates.

params_modl <- list(
  kphio              = 0.04998,
  kphio_par_a        = 0.0,
  kphio_par_b        = 1.0,
  soilm_thetastar    = 0.6 * 240,
  soilm_betao        = 0.0,
  beta_unitcostratio = 146.0,
  rd_to_vcmax        = 0.014,
  tau_acclim         = 30.0,
  kc_jmax            = 0.41
)

# run the model
output <- rsofun::runread_pmodel_f(
  driver |> 
    mutate(forcing = purrr::map(forcing, ~mutate(., co2 = 400))),
  par = params_modl
)

# some simulations failed due to missing values in the forcing. If that happens,
# the number of rows in the output data is 1.
output <- output |>
  mutate(len = purrr::map_int(data, ~nrow(.))) |>
  filter(len >= 1) |> # at least 3 years data
  select(-len)

This yields data and model outputs for 216 sites. Let’s look for trends…