Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRenchon committed Aug 30, 2024
1 parent 097066e commit 7f884e9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/diagnostics/developers_diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 25 additions & 0 deletions docs/src/diagnostics/users_diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 7f884e9

Please sign in to comment.