Skip to content

Can't filter_typename in uproot.dask #1363

Open
@jpivarski

Description

@jpivarski

Some types of branches can't be interpreted, but we should be able to skip them and read everything else. Here's a file that has a branch named "PARAMETERS/_intMap/_intMap.first" whose interpretation is Unknown: https://cernbox.cern.ch/rootjs/public/dIbBvBgjhm1swNO/events_000189367.root?contextRouteName=files-public-link&contextRouteParams.driveAliasAndItem=public%2FdIbBvBgjhm1swNO&items-per-page=100

You can skip the unknown branches with uproot.concatenate (the eager equivalent of uproot.dask):

>>> uproot.concatenate("events_000189367.root:events", filter_typename=lambda x: x != "unknown", entry_stop=1)
<Array [{'Muon#0.index': [30], ...}, ...] type='100000 * {"Muon#0.index": v...'>

but you can't delay that read with Dask:

>>> uproot.dask("events_000189367.root:events", filter_typename=lambda x: x != "unknown", entry_stop=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jpivarski/irishep/uproot5/src/uproot/_dask.py", line 277, in dask
    return _get_dak_array(
           ^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/_dask.py", line 1542, in _get_dak_array
    base_form = _get_ttree_form(
                ^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/_dask.py", line 1385, in _get_ttree_form
    content_form = branch.interpretation.awkward_form(ttree.file)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/grouped.py", line 105, in awkward_form
    fields.append(y.awkward_form(file, context))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/grouped.py", line 105, in awkward_form
    fields.append(y.awkward_form(file, context))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/identify.py", line 1203, in awkward_form
    raise self
  File "/Users/jpivarski/irishep/uproot5/src/uproot/behaviors/TBranch.py", line 1945, in interpretation
    self._interpretation = uproot.interpretation.identify.interpretation_of(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jpivarski/irishep/uproot5/src/uproot/interpretation/identify.py", line 507, in interpretation_of
    raise UnknownInterpretation(
uproot.interpretation.identify.UnknownInterpretation: none of the rules matched
in file events_000189367.root
in object /events;34:PARAMETERS/_intMap/_intMap.first

It seems like uproot.dask is ignoring the filter_name argument. That's an important argument for work-arounds like this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug (unverified)The problem described would be a bug, but needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions