From 3ae34b76b725338d6cb30d102a3784aeb181fae4 Mon Sep 17 00:00:00 2001 From: kmdeck Date: Wed, 31 May 2023 09:56:08 -0700 Subject: [PATCH] add lwp data --- experiments/LSM/ozark/ozark.jl | 79 ++++++++++++++++-------- test/Vegetation/canopy_model.jl | 4 +- test/Vegetation/plant_hydraulics_test.jl | 4 +- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/experiments/LSM/ozark/ozark.jl b/experiments/LSM/ozark/ozark.jl index 67d36e35bd..6f61870b5b 100644 --- a/experiments/LSM/ozark/ozark.jl +++ b/experiments/LSM/ozark/ozark.jl @@ -104,8 +104,8 @@ end plant_hydraulics_ps = PlantHydraulics.PlantHydraulicsParameters(; area_index = area_index, - plant_ν = plant_ν, - plant_S_s = plant_S_s, + ν = plant_ν, + S_s = plant_S_s, root_distribution = root_distribution, conductivity_model = conductivity_model, retention_model = retention_model, @@ -336,6 +336,46 @@ plt2 = Plots.plot( Plots.plot(plt2, plt1, layout = (2, 1)) Plots.savefig(joinpath(savedir, "soil_water_content.png")) +dt_model = sol.t[2] - sol.t[1] +dt_data = seconds[2] - seconds[1] +Plots.plot(daily, cumsum(T) * dt_model, label = "Model T") +Plots.plot!( + seconds ./ 24 ./ 3600, + cumsum(measured_T[:]) * dt_data, + label = "Data ET", +) +Plots.plot!( + seconds ./ 24 ./ 3600, + cumsum(P[:]) * dt_data * (1e3 * 24 * 3600), + label = "Data P", +) +Plots.plot!(ylabel = "∫ Water fluxes dt", xlabel = "Days", margins = 10Plots.mm) +Plots.savefig(joinpath(savedir, "cumul_p_et.png")) + +# Leaf water potential data from Pallardy et al (2018) +# Predawn Leaf Water Potential of Oak-Hickory Forest at Missouri Ozark (MOFLUX) Site: 2004-2020 +# https://doi.org/10.3334/CDIAC/ORNLSFA.004 +lwp_filename = "MOFLUX_PredawnLeafWaterPotential_2020_20210125.csv" +lwp_artifact = ArtifactFile( + url = "https://caltech.box.com/shared/static/d2nbhezw1q99vslnh5qfwnqrnp3p4edo.csv", + filename = lwp_filename, +) +lwp_dataset = ArtifactWrapper( + @__DIR__, + "lwp_pallardy_etal2018", + ArtifactFile[lwp_artifact], +); + +lwp_path = joinpath(get_data_folder(lwp_dataset), lwp_filename) +lwp_data = readdlm(lwp_path, ',', skipstart = 1) +# We are using 2005 data in this test, so restrict to this year +YEAR = lwp_data[:, 1] +DOY = lwp_data[YEAR .== 2005, 2] +# Our t0 = Dec 31, midnight, 2004. Predawn = guess of 0600 hours +seconds_since_t0 = FT.(DOY) * 24 .* 3600 .+ (6 * 3600) +lwp_measured = lwp_data[YEAR .== 2005, 7] .* 1e6 # MPa to Pa + + root_stem_flux = [ sum(sv.saveval[k].root_extraction) .* (1e3 * 3600 * 24) for k in 1:length(sol.t) @@ -353,15 +393,15 @@ leaf_air_flux = [ plt1 = Plots.plot( daily, - root_stem_flux, - label = "Soil-root-stem flux", + leaf_air_flux, + label = "Leaf-air flux", ylabel = "Within plant fluxes[mm/day]", xlim = [minimum(daily), maximum(daily)], size = (500, 700), margins = 10Plots.mm, ) Plots.plot!(plt1, daily, stem_leaf_flux, label = "Stem-leaf flux") -Plots.plot!(plt1, daily, leaf_air_flux, label = "Leaf-air flux") +Plots.plot!(plt1, daily, root_stem_flux, label = "Soil-root-stem flux") lwp = [ parent(sv.saveval[k].canopy.hydraulics.ψ)[2] * 9800 for k in 1:length(sol.t) @@ -373,35 +413,24 @@ swp = [ plt2 = Plots.plot( daily, lwp, - label = "Leaf", + label = "Model, Leaf", xlim = [minimum(daily), maximum(daily)], xlabel = "days", ylabel = "Water potential (Pa)", size = (500, 700), left_margin = 10Plots.mm, ) +Plots.plot!(plt2, daily, swp, label = "Model, Stem") -Plots.plot!(plt2, daily, swp, label = "Stem") - -Plots.plot(plt2, plt1, layout = (2, 1)) -Plots.savefig(joinpath(savedir, "plant_hydraulics.png")) - - -dt_model = sol.t[2] - sol.t[1] -dt_data = seconds[2] - seconds[1] -Plots.plot(daily, cumsum(T) * dt_model, label = "Model T") -Plots.plot!( - seconds ./ 24 ./ 3600, - cumsum(measured_T[:]) * dt_data, - label = "Data ET", -) Plots.plot!( - seconds ./ 24 ./ 3600, - cumsum(P[:]) * dt_data * (1e3 * 24 * 3600), - label = "Data P", + plt2, + seconds_since_t0 ./ 24 ./ 3600, + lwp_measured, + label = "Data; all species", ) -Plots.plot!(ylabel = "∫ Water fluxes dt", xlabel = "Days", margins = 10Plots.mm) -Plots.savefig(joinpath(savedir, "cumul_p_et.png")) +Plots.plot(plt2, plt1, layout = (2, 1)) +Plots.savefig(joinpath(savedir, "plant_hydraulics.png")) + rm(joinpath(savedir, "Artifacts.toml")) diff --git a/test/Vegetation/canopy_model.jl b/test/Vegetation/canopy_model.jl index 56ec5b44f0..45466c09be 100644 --- a/test/Vegetation/canopy_model.jl +++ b/test/Vegetation/canopy_model.jl @@ -121,8 +121,8 @@ include(joinpath(pkgdir(ClimaLSM), "parameters", "create_parameters.jl")) end plant_hydraulics_ps = PlantHydraulics.PlantHydraulicsParameters(; area_index = area_index, - plant_ν = plant_ν, - plant_S_s = plant_S_s, + ν = plant_ν, + S_s = plant_S_s, root_distribution = root_distribution, conductivity_model = conductivity_model, retention_model = retention_model, diff --git a/test/Vegetation/plant_hydraulics_test.jl b/test/Vegetation/plant_hydraulics_test.jl index 4aaffa3f60..a14a86e4dd 100644 --- a/test/Vegetation/plant_hydraulics_test.jl +++ b/test/Vegetation/plant_hydraulics_test.jl @@ -143,8 +143,8 @@ include(joinpath(pkgdir(ClimaLSM), "parameters", "create_parameters.jl")) param_set = PlantHydraulics.PlantHydraulicsParameters(; area_index = area_index, - plant_ν = plant_ν, - plant_S_s = plant_S_s, + ν = plant_ν, + S_s = plant_S_s, root_distribution = root_distribution, conductivity_model = conductivity_model, retention_model = retention_model,