Skip to content

Commit

Permalink
Use PrettyTables for Available Diagnostics docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Oct 20, 2023
1 parent 6bee1ae commit 8d005ab
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 36 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ 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
1 change: 0 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ bib = CitationBibliography(joinpath(@__DIR__, "bibliography.bib"))
doctest(ClimaAtmos; plugins = [bib])
disable_logging(Base.CoreLogging.BelowMinLevel) # Re-enable all logging

include("make_diagnostic_table.jl")
makedocs(;
plugins = [bib],
modules = [ClimaAtmos],
Expand Down
32 changes: 0 additions & 32 deletions docs/make_diagnostic_table.jl

This file was deleted.

6 changes: 6 additions & 0 deletions docs/src/available_diagnostics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Available diagnostic variables

Autogenerate table of available diagnostics:
```@example
include("make_diagnostic_table.jl")
```
27 changes: 27 additions & 0 deletions docs/src/make_diagnostic_table.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import ClimaAtmos as CA
using PrettyTables

# Print all available diagnostics to an ASCII table

short_names = []
long_names = []
units = []
comments = []
standard_names = []
for d in values(CA.Diagnostics.ALL_DIAGNOSTICS)
push!(short_names, d.short_name)
push!(long_names, d.long_name)
push!(units, d.units)
push!(comments, d.comments)
push!(standard_names, d.standard_name)
end
data = hcat(short_names, long_names, units, comments, standard_names)
pretty_table(
data;
autowrap = true,
linebreaks = true,
columns_width = [10, 15, 8, 32, 15], # Width = 80
body_hlines = collect(1:size(data)[1]),
header = ["Short name", "Long name", "Units", "Comments", "Standard name"],
alignment = :l,
)

0 comments on commit 8d005ab

Please sign in to comment.