TMA02_hourly_data.csv : 17 days of hourly air
temperature and relative humidity data above and below the woodland
canopy.
TMA02_daymax.csv : 17 days of daily maximum relative
humidity temperature above and below the woodland canopy.
Import the csv files and converts date columns to Date or Date-time objects:
# Read in the hourly data, set the date_time column to the correct format
hourly <- read_csv("data/TMA02_hourly_data.csv",
col_types = cols(
date_time = col_datetime(format = "%Y-%m-%d %H:%M:%S")
)
)
# Read in the daily data, set the Date column to the correct format
daymax <- read_csv("data/TMA02_daymax.csv",
col_types = cols(
Date = col_date(format = "%Y-%m-%d")
)
)
Calculate the hourly vapour pressure of the air above and below the canopy:
psat <- function(temp.air) {
6.108 * exp(17.27 * temp.air / (temp.air + 237.3))
}
pvap <- function(relative.humidity, psat) {
relative.humidity / 100 * psat
}
hourly$Psat_above <- psat(hourly$Tair_above)
hourly$Psat_below <- psat(hourly$Tair_below)
hourly$Pvap_above <- pvap(hourly$RelHum_above, hourly$Psat_above)
hourly$Pvap_below <- pvap(hourly$RelHum_below, hourly$Psat_below)
Plot the vapour pressure data above and below the canopy over time on one plot:
pvap_plot <- plot(Pvap_below ~ date_time,
data = hourly,
type = "n",
xlab = "Date and Time",
ylab = "Vapour Pressure (hPa)",
title = "Plot of vapour pressure below and above canopy over time (17 Days Aug 2025)"
)
lines(Pvap_above ~ date_time,
data = hourly,
type = "l",
col = "blue",
lty = 1
)
lines(Pvap_below ~ date_time,
data = hourly,
type = "l",
col = "darkred",
lty = 2
)
legend("bottomleft",
legend = c("Above the canopy", "Below the canopy"),
col = c("blue", "darkred"),
lty = c(1, 2)
)
pvap_ggplot <- ggplot(data = hourly) +
geom_line(
mapping = aes(x = date_time, y = Pvap_above),
col = "blue",
lty = 1
) +
geom_point(
size = 1,
mapping = aes(x = date_time, y = Pvap_below),
col = "darkred"
)
pvap_ggplot %>%
plotly::ggplotly(tooltip = c("Pvap_below", "Pvap_above")) %>%
layout(hovermode = "x unified")
for (data in c("RelHum_below", "RelHum_above", "Tair_below", "Tair_above", "Pvap_below", "Pvap_above")) {
glue(data, ": ")
cat(
"<Mean:", mean(hourly[[data]]) %>% round(digits = 2),
" Std:", sd(hourly[[data]]) %>% round(digits = 2), ">\n"
)
}
## <Mean: 75.18 Std: 15.39 >
## <Mean: 73.55 Std: 14.22 >
## <Mean: 18.16 Std: 3.07 >
## <Mean: 18.3 Std: 2.98 >
## <Mean: 15.45 Std: 2.33 >
## <Mean: 15.27 Std: 2.2 >