If I understand correctly, you want to sample every (2^n):th value of the array, in each of the 3 dimensions.
You can do this by indexing as follows.
>>> import numpy as np
>>> n = 1
>>> example_array = np.zeros((1024,1024,1024))
>>> N = 2^n
>>> example_array_sampled = example_array[::N, ::N, ::N]
>>> example_array_sampled.shape
(512, 512, 512)
Verifying that it actually samples evenly:
>>> np.arange(64).reshape((4,4,4))[::2,::2,::2]
array([[[ 0, 2],
[ 8, 10]],
[[32, 34],
[40, 42]]])
This particular code still assumes that you will read in the whole array in memory before indexing into it. And the variable example_array_sampled
will be a view into the original array.
More info on indexing numpy arrays: https://numpy.org/doc/stable/reference/arrays.indexing.html
Some info on numpy views: https://scipy-cookbook.readthedocs.io/items/ViewsVsCopies.html
Related question (in one dimension): subsampling every nth entry in a numpy array