Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Aug 15, 2024
1 parent 4d8b5a0 commit a401acd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
44 changes: 30 additions & 14 deletions experiments/integrated/fluxnet/ozark_pft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -382,7 +390,7 @@ else
plot_avg_comp(
"GPP",
model_GPP,
dt * n,
dt_save,
GPP_data,
FT(DATA_DT),
num_days,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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) .*
Expand All @@ -469,7 +485,7 @@ else
plot_avg_comp(
"ET",
ET_model,
dt * n,
dt_save,
ET_data,
FT(DATA_DT),
num_days,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions experiments/standalone/Vegetation/timestep_test.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import SciMLBase
import ClimaComms
@static pkgversion(ClimaComms) >= v"0.6" && ClimaComms.@import_required_backends
using CairoMakie
using Statistics
using Dates
Expand Down

0 comments on commit a401acd

Please sign in to comment.