pyinterp.reduced_gaussian.coalesce#
- pyinterp.reduced_gaussian.coalesce(ranges, io_gap)[source]#
Merge the ranges of a zone for reading, without changing the zone.
Many small reads cost more than a few larger ones: merging ranges closer than
io_gappoints reads the gaps too, thengatherpicks the values of the zone from what was read.- Parameters:
ranges (ArrayLike) – The ranges of a zone, as
Zone.ranges()returns them.io_gap (int) – Largest gap, in points, read to merge two ranges.
- Returns:
the ranges to read, and the positions of the values of the zone in the concatenation of what they read.
- Return type:
(merged, gather)
Example
>>> merged, gather = coalesce(zone.ranges(), io_gap=256) >>> buffer = np.concatenate( ... [values[start:stop] for start, stop in merged] ... ) >>> zone_values = buffer[gather]