From 0037d8c85326e2922eb5bcaeddd5b080c6cda201 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Mon, 22 Jul 2024 23:26:30 -0700 Subject: [PATCH] Add support for reading Carpet pre-2012 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 --- NEWS.md | 7 +++++++ kuibit/cactus_grid_functions.py | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 8edd5e60..f9eee092 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/kuibit/cactus_grid_functions.py b/kuibit/cactus_grid_functions.py index 6b498e9c..06881edc 100755 --- a/kuibit/cactus_grid_functions.py +++ b/kuibit/cactus_grid_functions.py @@ -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 = [