Skip to content

Commit

Permalink
Merge pull request #2713 from CliMA/js/diags
Browse files Browse the repository at this point in the history
overwrite duplicate diagnostics
  • Loading branch information
juliasloan25 authored Feb 27, 2024
2 parents 30b3cd8 + de58d31 commit 6e42940
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/diagnostics/diagnostic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,14 @@ function add_diagnostic_variable!(;
comments = "",
compute!,
)
haskey(ALL_DIAGNOSTICS, short_name) &&
error("diagnostic $short_name already defined")
haskey(ALL_DIAGNOSTICS, short_name) && @warn(
"overwriting diagnostic `$short_name` entry containing fields\n" *
"$(map(
field -> "$(getfield(ALL_DIAGNOSTICS[short_name], field))",
filter(field -> field != :compute!, fieldnames(DiagnosticVariable)),
))"
)


ALL_DIAGNOSTICS[short_name] = DiagnosticVariable(;
short_name,
Expand Down

0 comments on commit 6e42940

Please sign in to comment.