You should tell us the lenth of gridset2
and the shape of pltz
.
But I've deduced from the documentation that user2357112
gave us that
len(gridset2) == 17
pltz.shape[1] == 160
http://docs.scipy.org/doc/numpy-1.10.0/reference/arrays.indexing.html#combining-advanced-and-basic-indexing
- The advanced indexes are separated by a slice, ellipsis or newaxis.
For example
x[arr1, :, arr2]
.
- The advanced indexes are all next to
each other. For example
x[..., arr1, arr2, :]
but not x[arr1, :, 1]
since 1 is an advanced index in this regard.
In the first case, the
dimensions resulting from the advanced indexing operation come first
in the result array, and the subspace dimensions after that. In the
second case, the dimensions from the advanced indexing operations are
inserted into the result array at the same spot as they were in the
initial array
>>> pltz[10,:,gridset2].shape
(17, 160)
This is the first case in the quote, a slice in the middle. gridset2
is advanced indexing
(e.g. [1,2,3,...]). It is put first; the [10,:]
subspace is placed after.
>>> pltz[10][:,gridset2].shape
(160, 17)
with pltz[10]
, the new array (a view) is 2d `(160,N)'. It now puts the size 17 dim last, the 2nd case in the documentation.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…