-
Notifications
You must be signed in to change notification settings - Fork 37
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
Convert numpy arrays to ASCII strings #956
Conversation
Params in C++ land at least does support vector I.O. I don't know what the right check is in python land, though. |
oops did not mean to close. Sorry. |
Is this actually an h5py issue?
which, in the code, is dumped as
where I get
for
So the "char/int" interpretation stems from the missing In case, it's not an issue on how the Attribute is written, does |
Actually, we could consider adding an additional overload for |
If the fix is in parthenon, I would prefer to make it there, as that seems like it is more likely to be maintainable, rather than a conversion on the python side. |
Thanks for noticing the value is already mangled as seen by
but with this change we now get
Similarly, |
I also just checked and the code correctly recovers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @brryan this is a clean fix. Probably my bad for the bug in the first place... I was the last one to touch the attributes stuf...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, this definitely looks like the right fix.
PR Summary
Newer versions of
h5py
appear to convert string values in HDF5 attributes to numpy arrays of ASCII values (e.g.[10 200 45 109 ...]
). This PR returns these values to strings.Currently this PR acts on all numpy arrays that appear as values in the
Params
attribute; I think this is OK becauseParams
doesn't support vector input but it is worth thinking about in case there is a better way to deal with this.PR Checklist