Skip to content

Commit

Permalink
Add SoilCanopyModel diagnostics
Browse files Browse the repository at this point in the history
This PR finalizes the addition of SoilCanopyModel diagnostics.
It also adds a macro to generate land compute functions,
And an optional argument for period averaging for default diagnostics.

Co-authored-by: AlexisRenchon <a.renchon@gmail.com>
Co-authored-by: SBozzolo <gbozzola@caltech.edu>
Co-authored-by: kmdeck <kdeck@caltech.edu>
Co-authored-by: braghiere <renato.braghiere@gmail.com>
  • Loading branch information
4 people committed Aug 7, 2024
1 parent ac57809 commit b409e1a
Show file tree
Hide file tree
Showing 8 changed files with 573 additions and 950 deletions.
9 changes: 8 additions & 1 deletion docs/src/diagnostics/make_diagnostic_table.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ for d in values(CL.Diagnostics.ALL_DIAGNOSTICS)
push!(comments, d.comments)
push!(standard_names, d.standard_name)
end
data = hcat(short_names, long_names, units, comments, standard_names)
i = sortperm(short_names) # indices of short_names sorted alphabetically
data = hcat(
short_names[i],
long_names[i],
units[i],
comments[i],
standard_names[i],
)
pretty_table(
data;
autowrap = true,
Expand Down
2 changes: 1 addition & 1 deletion experiments/long_runs/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
land,
t0;
output_writer = nc_writer,
output_vars = :short,
output_vars = :long,
)

diagnostic_handler =
Expand Down
119 changes: 0 additions & 119 deletions src/diagnostics/bucket_compute_methods.jl

This file was deleted.

18 changes: 14 additions & 4 deletions src/diagnostics/default_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function default_diagnostics(land_model::BucketModel, t_start; output_writer)
"wsoil",
"wsfc",
"ssfc",
] # TO DO: would it be helpful to return this list?
]

default_outputs =
hourly_averages(bucket_diagnostics...; output_writer, t_start)
Expand All @@ -75,6 +75,7 @@ function default_diagnostics(
t_start;
output_writer,
output_vars = :long,
average_period = :hourly,
)

define_diagnostics!(land_model)
Expand All @@ -96,7 +97,7 @@ function default_diagnostics(
"gs",
"mt",
"trans",
"rain", # do we want?
"rain",
"an",
"gpp",
"rd",
Expand All @@ -118,8 +119,17 @@ function default_diagnostics(
soilcanopy_diagnostics = ["gpp", "ct", "ai", "slw", "si"]
end

default_outputs =
hourly_averages(soilcanopy_diagnostics...; output_writer, t_start)
if average_period == :hourly
default_outputs =
hourly_averages(soilcanopy_diagnostics...; output_writer, t_start)
elseif average_period == :daily
default_outputs =
daily_averages(soilcanopy_diagnostics...; output_writer, t_start)
elseif average_period == :monthly # !! this is currently 30 days, not exact month
default_outputs =
monthly_averages(soilcanopy_diagnostics...; output_writer, t_start)
end

return [default_outputs...]
end

Expand Down
Loading

0 comments on commit b409e1a

Please sign in to comment.