Skip to content

Commit

Permalink
Check if "ClimaCore version" is already attribute
Browse files Browse the repository at this point in the history
HDF5.jl complains if you try writing an attribute that already exists
  • Loading branch information
Sbozzolo committed Sep 18, 2023
1 parent 72c1063 commit 1be36f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/InputOutput/writers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1be36f6

Please sign in to comment.