'N-dimensional array indexing with numpy

Indexing in 'k' direction in a N dimensional array (cube)

I have imported a cube in Python and I would like to index the cube but in 'k' axis (N and M are two integer numbers), and then cross it by a plane (b) in the 'i' direction. I was trying to index in this way: cube[N:M][b][:], but the indexing for N-dimensional arrays works different. I am bit confused. Someone could help me? My main question is: How to handle N-dimensions index?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source