cf.Data.__getitem__¶

Data.
__getitem__
(indices)[source]¶ Return a subspace of the data defined by indices.
d.__getitem__(indices) <==> d[indices]
Indexing follows rules that are very similar to the numpy indexing rules, the only differences being:
An integer index i takes the ith element but does not reduce the rank by one.
When two or more dimensions’ indices are sequences of integers then these indices work independently along each dimension (similar to the way vector subscripts work in Fortran). This is the same behaviour as indexing on a
netCDF4.Variable
object.
. seealso::
__setitem__
,_parse_indices
 Returns
Data
The subspace of the data.
Examples:
>>> import numpy >>> d = Data(numpy.arange(100, 190).reshape(1, 10, 9)) >>> d.shape (1, 10, 9) >>> d[:, :, 1].shape (1, 10, 1) >>> d[:, 0].shape (1, 1, 9) >>> d[..., 6:3:1, 3:6].shape (1, 3, 3) >>> d[0, [2, 9], [4, 8]].shape (1, 2, 2) >>> d[0, :, 2].shape (1, 10, 1)