1

In awkward0 I would like to separately persist various selections of a table

in pseudo code

X = awkward.Table(...)

one_jet = X[X.n_jet == 1]
two_jet = X[X.n_jet == 1]

awkward.save(one_jet)
awkward.save(two_jet)

but I notices the contents of any indexed jagged array doesn't change (only the starts stops are thinned), and so naively saving starts, stops this way would lear to a duplication of data on disk. Is there a way to "repack" jagged array so they become dense again?

Lukas Heinrich
  • 223
  • 2
  • 6

1 Answers1

0

I recently ran into this issue as well. The cleanest solution I found was to construct a new awkward array from the masked array, then save the new array.

X = awkward.Table(...)

one_jet = awkward.fromiter(X[X.n_jet == 1])
two_jet = awkward.fromiter(X[X.n_jet == 2]) # I assume you meant 2 here?

awkward.save(one_jet)
awkward.save(two_jet)
Will
  • 33
  • 1
  • 5