# tealeaves: Intermediate Users

#### 2022-07-19

In this more advanced example, we’ll model leaf temperature across a gradient of air temperatures from 0 to 40 °C for leaves under low and high light conditions. We’ll also look at differences between hypostomatous and amphistomatous leaves. We use the argument to save time1, but it still takes a couple minutes. I’ve saved the output as example data called .


# install tidyverse packages if necessary
# install.packages("tidyverse")

library(dplyr)
library(ggplot2)
library(magrittr)
library(tealeaves)

# Parameter sets ----

cs <- tealeaves::make_constants()
lp <- tealeaves::make_leafpar(
replace = list(
# Hypo- and amphistomatous leaves
logit_sr = set_units(c(-Inf, 0))
)
)
ep <- tealeaves::make_enviropar(
replace = list(
# Low and high light
S_sw = set_units(c(220, 660), "W/m^2"),
# Air temperature gradient
T_air = set_units(seq(278.15, 313.15, length.out = 25), "K")
)
)

# Run tleaves ----
tl_example1 <- tleaves(lp, ep, cs)

usethis::use_data(tl_example1)

Next, we’ll usee ggplot2 to plot the leaf-to-air temperature difference as function of air temperature at the two light levels.

The results show that leaves are warmer than the atmosphere at cool temperatures and cooler at high temperatures. In sunnier conditions, leaves are warmer. Finally, amphistomatous leaves are somewhat cooler because they evaporate more water. To see this, let’s look directly at transpiration in the same data:

1. The ’unit’ed version ensures that all calculations start and end with the proper units. The unitless functions should give the same answer because I run tests every time the package is updated, but it’s always good to double check for bugs.↩︎