assert len(inShape) == len(finalShape)
mults = []
for i in range(len(inShape)):
    if finalShape[i] < inShape[i]:
        mults.append(int(np.ceil(inShape[i] / finalShape[i])))
else:
    mults.append(1)
tempShape = tuple([(i * j) for i, j in zip(finalShape, mults)])
zoomMultipliers = np.array(tempShape) / np.array(inShape) + 1e-07
rescaled = zoom(inArray, zoomMultipliers, **zoomKwargs)
for ind, mult in enumerate(mults):
    if mult != 1:
        sh = list(rescaled.shape)
Python: downsample 2D numpy array by a non-integer factor