Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if "ClimaCore version" is already attribute #1464

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/InputOutput/writers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,16 @@ 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
if haskey(attributes(file), "ClimaCore version")
file_version = VersionNumber(attrs(file)["ClimaCore version"])
current_version = VERSION
if file_version != current_version
@warn "$filename was written using a different version of ClimaCore than is currently loaded" file_version current_version
end
else
write_attribute(file, "ClimaCore version", string(VERSION))
end
cache = Dict{String, String}()
return HDF5Writer(file, context, cache)
end
Expand Down
Loading