Skip to content

Commit

Permalink
Add automatically generated list of diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbozzolo committed Sep 6, 2023
1 parent 75169b0 commit 828b65b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ deps/src/
docs/build/
docs/site/

# File generated by make_available_diagnostics.jl
docs/src/available_diagnostics.md

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
Expand Down
3 changes: 3 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ disable_logging(Base.CoreLogging.Info) # Hide doctest's `@info` printing
doctest(ClimaAtmos)
disable_logging(Base.CoreLogging.BelowMinLevel) # Re-enable all logging

include("make_diagnostic_table.jl")

makedocs(
CitationBibliography(joinpath(@__DIR__, "bibliography.bib")),
modules = [ClimaAtmos],
Expand All @@ -27,6 +29,7 @@ makedocs(
"Equations" => "equations.md",
"EDMF Equations" => "edmf_equations.md",
"Diagnostics" => "diagnostics.md",
"Available Diagnostics" => "available_diagnostics.md",
"Diagnostic EDMF Equations" => "diagnostic_edmf_equations.md",
"Gravity Wave Drag Parameterizations" => "gravity_wave.md",
"Radiative Equilibrium" => "radiative_equilibrium.md",
Expand Down
23 changes: 23 additions & 0 deletions docs/make_diagnostic_table.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import ClimaAtmos as CA

# Read all the diagnostics we know how to compute, and print them into a
# markdown table that is later compiled into the docs

open("src/available_diagnostics.md", "w") do file

write(file, "# Available diagnostics\n\n")

write(
file,
"| Short name | Long name | Standard Name | Units | Comments |\n",
)
write(file, "|---|---|---|---|---|\n")

for d in values(CA.ALL_DIAGNOSTICS)
write(file, "| $(d.short_name) ")
write(file, "| $(d.long_name) ")
write(file, "| $(d.standard_name) ")
write(file, "| $(d.units) ")
write(file, "| $(d.comments)|\n")
end
end
3 changes: 2 additions & 1 deletion docs/src/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ push!(diagnostics, get_daily_max("air_density", "air_temperature"))
Now `diagnostics` will also contain the instructions to compute the daily
maximum of `air_density` and `air_temperature`.

**TODO: Add link to table with known diagnostics**
The diagnostics that are built-in `ClimaAtmos` are collected in [Available
diagnostics](@ref).

If you are using `ClimaAtmos` with a script-based interface, you have access to
the complete flexibility in your diagnostics. Read the section about the
Expand Down

0 comments on commit 828b65b

Please sign in to comment.