File: make_jagged0_avro.py

package info (click to toggle)
python-awkward 2.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 23,088 kB
  • sloc: python: 148,689; cpp: 33,562; sh: 432; makefile: 21; javascript: 8
file content (28 lines) | stat: -rw-r--r-- 752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import numpy as np
import awkward as ak
import uproot
import fastavro

content = np.memmap("/home/jpivarski/storage/data/chep-2021-jagged-jagged-jagged/sample-content.float32", np.float32)

array = content

events_per_basket = 16777197

schema = fastavro.parse_schema({
    "name": "jagged0",
    "namespace": "org.awkward-array",
    "type": "float"
})

for level in [9, 1]:  # 9, 1, 0:
    print("level", level)
    with open("/home/jpivarski/storage/data/chep-2021-jagged-jagged-jagged/lzfour" + str(level) + "-jagged0.avro", "wb") as out:
        fastavro.writer(
            out,
            schema,
            array,
            codec="lz4",  # "deflate",
            codec_compression_level=level,
            sync_interval=67108788,
        )