То, что вы ищете, вероятно, transpose
+ ravel
:
X = np.arange(27).reshape((3,3,3))
>>> X
([[[ 0, 1, 2],
[ 3, 4, 5],
[ 6, 7, 8]],
[[ 9, 10, 11],
[12, 13, 14],
[15, 16, 17]],
[[18, 19, 20],
[21, 22, 23],
[24, 25, 26]]])
Ваш x,y,z
:
>>> X.transpose((0,1,2)).ravel()
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26])
>>> X.transpose((1,2,0)).ravel()
array([ 0, 9, 18, 1, 10, 19, 2, 11, 20, 3, 12, 21, 4, 13, 22, 5, 14,
23, 6, 15, 24, 7, 16, 25, 8, 17, 26])
>>> X.transpose((2,0,1)).ravel()
array([ 0, 3, 6, 9, 12, 15, 18, 21, 24, 1, 4, 7, 10, 13, 16, 19, 22,
25, 2, 5, 8, 11, 14, 17, 20, 23, 26])