Skip to content

Commit

Permalink
Add support for reading Carpet pre-2012
Browse files Browse the repository at this point in the history
In very old versions of Carpet, the type of All Parameters was not
string, leading to failures when reading such files. This commit ensures
that "All Parameters" is always interpreted as a string
  • Loading branch information
Sbozzolo committed Jul 23, 2024
1 parent 53c2b60 commit 0037d8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 1.5.1

#### Bug fixes

- Add support to ready HDF5 files created with very old versions of Carpet (<
2012).

## Version 1.5.0 (19 June 2024)

#### General
Expand Down
5 changes: 4 additions & 1 deletion kuibit/cactus_grid_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,10 @@ def _are_ghostzones_in_file(path: str, is_3D_file: bool) -> bool:
with h5py.File(path, "r") as file_:
parameters = file_["Parameters and Global Attributes"]
all_pars = (
parameters["All Parameters"][()].decode().split("\n")
parameters["All Parameters"][()]
.tostring()
.decode()
.split("\n")
)
# We make sure that everything is lowercase, we are case insensitive
iohdf5_pars = [
Expand Down

0 comments on commit 0037d8c

Please sign in to comment.