if(params$save_plots) {
  out_plots <- file.path(out_path, 'Plots')
  if (!dir.exists(out_plots) && params$save_plots) {
    dir.create(out_plots, recursive = TRUE)
  }
}
file_name_input <- file.path(out_path,
                       paste0('simulation_input.rds'))
file_name_output <- file.path(out_path,
                       paste0('simulation_result.rds'))
input_object = readRDS(file_name_input)
res = readRDS(file_name_output)

PET & precipitation

type <- "PET_Precipitation"
p <-plot(res, type= type)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")), plot = p)
p

Evapotranspiration

type <- "Evapotranspiration"
p <-plot(res, type= type)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
p

Soil water potential

type <- "SoilPsi"
p <-plot(res, type= type)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
p

Plant LAI

type <- "PlantLAI"
p <-plot(res, type= type, bySpecies = TRUE)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
p

Transpiration per leaf

type <- "TranspirationPerLeaf"
p <-plot(res, type= type, bySpecies = TRUE)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
p

Stem PLC

type <- "StemPLC"
p <-plot(res, type= type, bySpecies = TRUE)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
p

Leaf PLC

type <- "LeafPLC"
p <-plot(res, type= type, bySpecies = TRUE)
if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
p

Plant/leaf water potential

if(params$conf=="granier") {
  type = "PlantPsi"
  p <-plot(res, type= type, bySpecies = TRUE)
  if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
} else {
  type = "LeafPsiRange"
  p <-plot(res, type= type, bySpecies = TRUE)
  if(params$save_plots) ggplot2::ggsave(filename = file.path(out_plots, paste0(type, ".png")),
                plot = p)
}
p


emf-creaf/medfatereports documentation built on Feb. 20, 2024, 6:45 a.m.