-
Notifications
You must be signed in to change notification settings - Fork 92
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
With this new structure, how do I read the attribute value itself? #579
Comments
Hi, no worries. I somewhat intentionally have not yet documented the new api since I might still change it soonish. You're very welcome to try it and give feedback. (Ask please feel free to ask as many questions as needed) If you already have a Dataset object, you can use JLD2.attributes(dset) Otherwise JLD2.load_attributes(g, datasetname) should still work. If it doesn't, I'll fix it. However, all of that API may potentially change in a future release. (Not in a way that breaks old data files, just possibly API functions) |
Thanks for the rapid response! I can use I can always switch back to the HDF5 package in the interim, but I really like using JLD2. Thanks again for the info. I work pretty much by myself, so I go down many wrong paths, and a little direction is always greatly appreciated. -- Denis |
Findfirst should still be ok. You got an OrderedDict. The entries are guaranteed to be in the correct order und iteration or e.g. (keys(dict) values(dict) |
The values are "ReadAttribute". Can I get the actual number easily? For example, ` ` The actual number for "Time" is 0.33300950325867074. |
Ah, damn. For now, use: I'll fix it, next time I'm at a computer... |
Ahh! Great, thanks. I had searched through the "read" functions but either missed that one or applied it incorrectly. Thanks again for the fast assistance! I can now continue to confront my ignorance of the non-Julia issues for which I'm using Julia. Many, many thanks. |
Using the |
Maybe not yet? Yesterday's fix still works, so I'm fine, but I get the same result now with the dev version and the non-dev version. With the dev: [033835bb] JLD2 v0.4.51 using JLD2 ┌ Warning: This file was not written with JLD2. Some things may not work. |
I appreciate your persistence. AFK for about another week but will eagerly
work with it when I return home. Thanks!
— Denis
…On Tue, Jul 30, 2024 at 6:10 PM JonasIsensee ***@***.***> wrote:
#580 <#580> This PR should make
JLD2.attributes(dset::Dataset) and JLD2.load_attributes(::JLDFile,
::String) return an OrderedDict with keys and the *actual* values in the
order they are found in the file.
—
Reply to this email directly, view it on GitHub
<#579 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE2LUY3LDUYEI2A3EG5FI2LZO7CJ7AVCNFSM6AAAAABLUQTJBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJYHAZDKOJRG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
My problem is not an "issue" as such, but my ignorance. Before the latest update, I loaded the attributes (JLD2.load_attributes(oneFile["Header"])), searched for the first element of the pair to get what I wanted and took its second element to obtain the value.
Now the pairs appear to be gone (or am I no longer looking in the right place?). I can get to the "ReadAttribute", but have not figured out how to get the value, e.g., of "Time" in "Header", out of it:
`
using JLD2
jfile = jldopen("xxx.hdf5")
h = JLD2.get_dataset(jfile, "Header")
h2 = h.attributes # OrderedCollections.OrderedDict{String, Any}
h2S = h2["Time"] # type is JLD2.ReadAttribute
`
Sorry to bother you.
-- dfc
The text was updated successfully, but these errors were encountered: