From 7f884e99c765723ad9944ae7c8d89459e02308a8 Mon Sep 17 00:00:00 2001 From: AlexisRenchon Date: Fri, 30 Aug 2024 09:54:51 -0700 Subject: [PATCH] WIP --- .../src/diagnostics/developers_diagnostics.md | 2 +- docs/src/diagnostics/users_diagnostics.md | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/src/diagnostics/developers_diagnostics.md b/docs/src/diagnostics/developers_diagnostics.md index 133c8826fa..9a344a9c4b 100644 --- a/docs/src/diagnostics/developers_diagnostics.md +++ b/docs/src/diagnostics/developers_diagnostics.md @@ -43,7 +43,7 @@ Note that you can also use the @diagnostic\_compute macro to do the same thing: @diagnostic\_compute "albedo" BucketModel p.bucket.α\_sfc ``` -The @with\_error macro define helper functions returning error messages if a user tries to compute a diagnostic variable that doesn't exist in their model type. +The `@with_error` macro define helper functions returning error messages if a user tries to compute a diagnostic variable that doesn't exist in their model type. # Define diagnostics diff --git a/docs/src/diagnostics/users_diagnostics.md b/docs/src/diagnostics/users_diagnostics.md index c61c4da2a4..143ca80922 100644 --- a/docs/src/diagnostics/users_diagnostics.md +++ b/docs/src/diagnostics/users_diagnostics.md @@ -137,3 +137,28 @@ my_custom_diagnostics = ["lhf", "bor"] diags = seasonal_maxs(my_custom_diagnostics...; output_writer, t_start) ``` +### Analyze your simulation output + +Once you've run your simulation and created an output folder (e.g., output\_dir) with diagnostics, you can use [ClimaAnalysis](https://github.com/CliMA/ClimaAnalysis.jl) +to access and analyze your data. For in depth documentation about ClimaAnalysis, see its [documentation](https://clima.github.io/ClimaAnalysis.jl/stable/). + +Here is an example of how to plot a variable: + +```Julia +import ClimaAnalysis + +import ClimaAnalysis.Visualize as viz + +import CairoMakie # the plotting package used by ClimaAnalysis + +simdir = ClimaAnalysis.SimDir(output_dir) # where output_dir is where you saved your diagnostics. + +var = get(simdir; "lhf") # assuming lhf, latent_heat_flux used as an example above, is one of your diagnostics variables. + +fig = CairoMakie.Figure() # creates an empty figure object + +viz.plot!(fig, var) # creates an axis inside fig, and plot your var in it. + +CairoMakie.save(fig) # saves the figure in current working directory +``` +