Reading doubly-ragged data in coffea #932
-
Hi coffea drinkers ☕ ! I really appreciate coffea and its developments, I have a question that may have an easy answer but I cannot find it in prior discussions or issues. One of the branches of the TTree of events I'm reading has a doubly-ragged structure: each entry in an event is a variable-length array and each entry in that array has its own variable-length arrays as members. When I try to read one of these doubly-ragged member arrays within a coffea processor, I get an error about
The other branches in this TTree are readable like normal (i.e. I have been only looking at single-entry or singly-ragged arrays so far). I am using the I have confirmed that this isn't an issue with my file by using
pip freeze output
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
Are you able to update uproot4 and awkward1? These are particularly old versions, even for awkward1/uproot4 and that may be the origin of your problem. |
Beta Was this translation helpful? Give feedback.
-
Similarly, can you show the code you're using to access the data which is causing this error? |
Beta Was this translation helpful? Give feedback.
-
Thank you @lgray for helping debug this issue, I'm just going to summarize the resolution here for any future reader. Update to a more recent coffea version The last stable versions of coffea (v0.7.2[0-2]) use a version of uproot/awkward that is unable1 to implement lazy-loading of doubly-ragged arrays. The easiest way around this issue is to update to a pre-release version of coffea Footnotes
|
Beta Was this translation helpful? Give feedback.
Thank you @lgray for helping debug this issue, I'm just going to summarize the resolution here for any future reader.
Update to a more recent coffea version
The last stable versions of coffea (v0.7.2[0-2]) use a version of uproot/awkward that is unable1 to implement lazy-loading of doubly-ragged arrays. The easiest way around this issue is to update to a pre-release version of coffea
pip install --pre --upgrade coffea
remembering to also update the processor(s) to reflect the change that the object provided todef process(self, events)
will be a dask-awkward array rather than a simple awkward array. This basically amounts to adding a.compute()
call where-ever you need the values (e.g. li…