From a401acd2ee4ca7403b970fdf78074a7ff94cf610 Mon Sep 17 00:00:00 2001 From: kmdeck Date: Thu, 15 Aug 2024 13:00:15 -0700 Subject: [PATCH] fix tests --- experiments/integrated/fluxnet/ozark_pft.jl | 44 +++++++++++++------ .../standalone/Vegetation/timestep_test.jl | 2 + 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/experiments/integrated/fluxnet/ozark_pft.jl b/experiments/integrated/fluxnet/ozark_pft.jl index 92f5ba968b..24d4ed7c04 100644 --- a/experiments/integrated/fluxnet/ozark_pft.jl +++ b/experiments/integrated/fluxnet/ozark_pft.jl @@ -347,7 +347,7 @@ num_days = N_days - N_spinup_days # Time series of model and data outputs data_times = [0:DATA_DT:(num_days * S_PER_DAY);] -model_times = [0:(n * dt):(num_days * S_PER_DAY);] +model_times = [0:dt_save:(num_days * S_PER_DAY);] # Plot model diurnal cycles without data comparisons # Autotrophic Respiration @@ -356,7 +356,15 @@ AR = parent(sv.saveval[k].canopy.autotrophic_respiration.Ra)[1] for k in 1:length(sv.saveval) ] .* 1e6 -plot_daily_avg("AutoResp", AR, dt * n, num_days, "μmol/m^2/s", savedir, "Model") +plot_daily_avg( + "AutoResp", + AR, + dt_save, + num_days, + "μmol/m^2/s", + savedir, + "Model", +) # Plot all comparisons of model diurnal cycles to data diurnal cycles # GPP @@ -370,7 +378,7 @@ if drivers.GPP.status == absent plot_daily_avg( "GPP", model_GPP, - dt * n, + dt_save, num_days, "μmol/m^2/s", savedir, @@ -382,7 +390,7 @@ else plot_avg_comp( "GPP", model_GPP, - dt * n, + dt_save, GPP_data, FT(DATA_DT), num_days, @@ -397,7 +405,7 @@ if drivers.SW_OUT.status == absent plot_daily_avg( "SW OUT", SW_out_model, - dt * n, + dt_save, num_days, "w/m^2", savedir, @@ -410,7 +418,7 @@ else plot_avg_comp( "SW OUT", SW_out_model, - dt * n, + dt_save, SW_out_data, FT(DATA_DT), num_days, @@ -425,7 +433,7 @@ if drivers.LW_OUT.status == absent plot_daily_avg( "LW OUT", LW_out_model, - dt * n, + dt_save, num_days, "w/m^2", savedir, @@ -438,7 +446,7 @@ else plot_avg_comp( "LW OUT", LW_out_model, - dt * n, + dt_save, LW_out_data, FT(DATA_DT), num_days, @@ -460,7 +468,15 @@ E = ] .* (1e3 * 24 * 3600) ET_model = T .+ E if drivers.LE.status == absent - plot_daily_avg("ET", ET_model, dt * n, num_days, "mm/day", savedir, "Model") + plot_daily_avg( + "ET", + ET_model, + dt_save, + num_days, + "mm/day", + savedir, + "Model", + ) else measured_T = drivers.LE.values ./ (LP.LH_v0(earth_param_set) * 1000) .* @@ -469,7 +485,7 @@ else plot_avg_comp( "ET", ET_model, - dt * n, + dt_save, ET_data, FT(DATA_DT), num_days, @@ -489,7 +505,7 @@ if drivers.H.status == absent plot_daily_avg( "SHF", SHF_model, - dt * n, + dt_save, num_days, "w/m^2", savedir, @@ -500,7 +516,7 @@ else plot_avg_comp( "SHF", SHF_model, - dt * n, + dt_save, SHF_data, FT(DATA_DT), N_days - N_spinup_days, @@ -517,13 +533,13 @@ LHF_canopy = [parent(sv.saveval[k].canopy.energy.lhf)[1] for k in 1:length(sol.t)] LHF_model = LHF_soil + LHF_canopy if drivers.LE.status == absent - plot_daily_avg("LHF", LHF_model, dt * n, num_days, "w/m^2", savedir) + plot_daily_avg("LHF", LHF_model, dt_save, num_days, "w/m^2", savedir) else LHF_data = drivers.LE.values[Int64(t_spinup ÷ DATA_DT):Int64(tf ÷ DATA_DT)] plot_avg_comp( "LHF", LHF_model, - dt * n, + dt_save, LHF_data, FT(DATA_DT), N_days - N_spinup_days, diff --git a/experiments/standalone/Vegetation/timestep_test.jl b/experiments/standalone/Vegetation/timestep_test.jl index ed89d3512d..d32b5163fb 100644 --- a/experiments/standalone/Vegetation/timestep_test.jl +++ b/experiments/standalone/Vegetation/timestep_test.jl @@ -1,4 +1,6 @@ import SciMLBase +import ClimaComms +@static pkgversion(ClimaComms) >= v"0.6" && ClimaComms.@import_required_backends using CairoMakie using Statistics using Dates