From 9984aee474b71e95c043a3aeaa8efef54c14d183 Mon Sep 17 00:00:00 2001 From: Beni Stocker Date: Thu, 30 May 2024 16:09:46 +0200 Subject: [PATCH] corrected the 30 vs 60 error --- vignettes/potential_cwd.Rmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vignettes/potential_cwd.Rmd b/vignettes/potential_cwd.Rmd index 51af1df..f17b356 100644 --- a/vignettes/potential_cwd.Rmd +++ b/vignettes/potential_cwd.Rmd @@ -93,9 +93,9 @@ visdat::vis_miss(df) ... and convert from units of mm s-1 to mm d-1. ```{r} # tested: identical results are obtained with: -# bigleaf::potential.ET(Tair = TA_F_MDS, pressure = PA_F*1e-3, Rn = NETRAD, approach = "Priestley-Taylor")$ET_pot * 30 * 30 * 24 +# bigleaf::potential.ET(Tair = TA_F_MDS, pressure = PA_F*1e-3, Rn = NETRAD, approach = "Priestley-Taylor")$ET_pot * 60 * 60 * 24 df <- df |> - mutate(pet = 30 * 30 * 24 * pet(NETRAD, TA_F_MDS, PA_F)) + mutate(pet = 60 * 60 * 24 * pet(NETRAD, TA_F_MDS, PA_F)) ``` ## Visualise, contrasting to observed ET after conversion of energy to mass units @@ -103,9 +103,9 @@ df <- df |> Convert latent heat flux (W/m2) to evapotranspiration in mass units (mm/d). ```{r} # tested: identical results are obtained with: -# bigleaf::LE.to.ET(LE_F_MDS, TA_F_MDS)* 30 * 30 * 24 +# bigleaf::LE.to.ET(LE_F_MDS, TA_F_MDS)* 60 * 60 * 24 le_to_et <- function(le, tc, patm){ - 1000 * 30 * 30 * 24 * le / (cwd::calc_enthalpy_vap(tc) * cwd::calc_density_h2o(tc, patm)) + 1000 * 60 * 60 * 24 * le / (cwd::calc_enthalpy_vap(tc) * cwd::calc_density_h2o(tc, patm)) } df <- df |> @@ -130,6 +130,7 @@ df |> ) + theme_classic() ``` + ## Cumulating PET - *P* Check annual totals. @@ -147,10 +148,9 @@ adf |> theme_classic() ``` -In some cases, the mean annual PET may be larger than the mean annual precipitation (*P*), leading to a steady long-term increase of a *potential* cumulative water deficit. This is not the case here (see plot above). For demonstration, let's assume precipitation was 30% of its actual value and calculate the running sum of (PET - *P*) - the cumulative potential evapotranspiration. +In some cases, the mean annual PET may be larger than the mean annual precipitation (*P*), leading to a steady long-term increase of a *potential* cumulative water deficit. This is the case here (see plot above). ```{r} df |> - mutate(P_F = 0.3 * P_F) |> mutate(pcwd = cumsum(pet - P_F)) |> ggplot(aes(TIMESTAMP, pcwd)) + geom_line() +