From de58d31800e8f1c6b0b3f9251bde73cf998a9c96 Mon Sep 17 00:00:00 2001 From: Julia Sloan Date: Fri, 23 Feb 2024 10:02:03 -0800 Subject: [PATCH] overwrite duplicate diags --- src/diagnostics/diagnostic.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/diagnostics/diagnostic.jl b/src/diagnostics/diagnostic.jl index dfa3e83894..cf589e3736 100644 --- a/src/diagnostics/diagnostic.jl +++ b/src/diagnostics/diagnostic.jl @@ -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,