From 1be36f656824965208e1b7a390ccf90cca2e4ecd Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Mon, 18 Sep 2023 14:14:28 -0700 Subject: [PATCH] Check if "ClimaCore version" is already attribute HDF5.jl complains if you try writing an attribute that already exists --- src/InputOutput/writers.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/InputOutput/writers.jl b/src/InputOutput/writers.jl index 29486ea897..3c25c30c85 100644 --- a/src/InputOutput/writers.jl +++ b/src/InputOutput/writers.jl @@ -59,7 +59,9 @@ function HDF5Writer( else file = h5open(filename, mode, context.mpicomm) end - write_attribute(file, "ClimaCore version", string(VERSION)) + # Add an attribute to the file if it doesn't already exist + haskey(attributes(file), "ClimaCore version") && + write_attribute(file, "ClimaCore version", string(VERSION)) cache = Dict{String, String}() return HDF5Writer(file, context, cache) end