apply method from Normalized tree water deficit: an automated dendrometer signal to quantify drought stress in trees by Peters et al https://doi.org/10.1111/nph.70266
# MPJ site coords (edit if needed)
MPJ_LAT <- 34.43
MPJ_LONG <- -106.13
# To make naming axises consistent and easier
## TWD and MDS (µm)
LABEL_TWD <- labs(y = "TWD (µm)")
LABEL_TWD_PD <- labs(y = "TWD_predawn (µm)") # twd_predawn is minimum TWD value before dawn of that day
LABEL_MDS <- labs(y = "MDS (µm)")
## Normalized TWD and MDS (Unitless)
LABEL_TWD_NORM <- labs(y = "TWD_norm (-)")
LABEL_MDS_NORM <- labs(y = "MDS_norm (-)")
## Timestamps
LABEL_TS <- labs(x = "Time")
LABEL_TS_15MIN <- labs(x = "Time (15-min)")
LABEL_TS_DATE <- labs(x = "Date")
# read pj_dendro
twd_dat <- read_csv(here("data/processed/PJ_DENDRO.csv")) |>
filter(!series %in% c("JCP292","JCP738","PCP728","PCP754")) |>
select(-"...1") |>
mutate(
species = case_when(
str_starts(series, "J") ~ "jumo",
str_starts(series, "P") ~ "pied",
TRUE ~ NA_character_
)
)
# precip for 2024-2025 should already be in data/processed/precip_24_25_daily.rds.
# uncommment the following script if you need to do it again, or add different years, but make sure you add the needed NMEG file to the data/raw folder.
#
source(here("code/supp/merge_precip_24_25.R"))
precip_24_25_daily <- read_rds(here("data/processed/precip_24_25_daily.rds"))
summary(twd_dat)
## series ts value
## Length:446901 Min. :2024-07-12 00:00:00 Min. :-2905.00
## Class :character 1st Qu.:2025-01-21 23:00:00 1st Qu.: -758.00
## Mode :character Median :2025-05-25 13:30:00 Median : -72.00
## Mean :2025-04-22 23:11:26 Mean : 46.56
## 3rd Qu.:2025-08-02 00:30:00 3rd Qu.: 420.00
## Max. :2025-10-09 18:30:00 Max. : 6260.00
## NA's :314
## max twd gro_yr frost
## Min. : 0.0 Min. : 0.0 Min. : 0.0 Mode :logical
## 1st Qu.: 19.0 1st Qu.: 202.0 1st Qu.: 0.0 FALSE:389495
## Median : 335.0 Median : 477.0 Median : 123.0 TRUE :57092
## Mean : 682.7 Mean : 636.2 Mean : 546.2 NA's :314
## 3rd Qu.:1087.0 3rd Qu.: 971.0 3rd Qu.: 787.0
## Max. :6260.0 Max. :2906.0 Max. :5156.0
## NA's :314 NA's :314 NA's :314
## flags version species
## Mode:logical Length:446901 Length:446901
## NA's:446901 Class :character Class :character
## Mode :character Mode :character
##
##
##
##
summary(precip_24_25_daily)
## date precip_daily
## Min. :2024-01-01 Min. : 0.000
## 1st Qu.:2024-07-01 1st Qu.: 0.000
## Median :2024-12-31 Median : 0.000
## Mean :2024-12-31 Mean : 1.106
## 3rd Qu.:2025-07-02 3rd Qu.: 0.000
## Max. :2026-01-01 Max. :64.600
p <- ggplot(twd_dat, aes(x = ts, y = twd, color = series)) +
geom_line() +
LABEL_TWD +
LABEL_TS_15MIN +
facet_wrap(~species, ncol = 1)
ggplotly(p)