toasty.merge Module¶
General tools for merging and downsampling tiles
The Merger Protocol¶
A “merger” is a callable that takes four input tiles and downsamples them into
a smaller tile. Its prototype is merger(big) -> small
, where big is a
Numpy array of at least 2 dimensions whose first two axes are both 512
elements in size. The return value small should have the same number of
dimensions as the input, two initial axes of size 256, and remaining axes the
same size as the input.
To efficiently vectorize two-by-two downsampling, a useful trick is to reshape
the (512, 512)
input tile into a shape (256, 2, 256, 2)
. You can then
use functions like np.mean()
with an argument axes=(1, 3)
to vectorize
the operation over sets of four adjacent pixels.
Functions¶
|
A merger function that averages quartets of pixels. |
|
Downsample image tiles all the way to the top of the pyramid. |
Classes¶
|
A utility for performing a merge operation with a |