Skip to content

Commit 4b9a500

Browse files
committed
Eagerly materialize the numpy array repr
1 parent 49b25b3 commit 4b9a500

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/mdio/segy/blocked_io.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,14 @@ def to_zarr( # noqa: PLR0913, PLR0915
110110

111111
segy_file = SegyFile(**segy_file_kwargs)
112112

113+
# Load in-memory Zarr grid map to NumPy array once to avoid Zarr slicing overhead in the submission loop
114+
grid_map_np = grid_map[:]
115+
113116
with executor:
114117
futures = []
115118
for region in chunk_iter:
116119
region_slices = tuple(region.values())
117-
local_grid_map = grid_map[region_slices[:-1]]
120+
local_grid_map = grid_map_np[region_slices[:-1]]
118121
# Pass zarr array handles and local grid map slice to workers
119122
future = executor.submit(
120123
trace_worker,

0 commit comments

Comments
 (0)