cfdm.H5netcdfArray.index¶
-
H5netcdfArray.
index
(conform=True)[source]¶ The index to be applied when converting to a
numpy
array.The
shape
is defined by theindex
applied to theoriginal_shape
.New in version (cfdm): 1.11.2.0
See also
- Parameters
- conform:
bool
, optional If True, the default, then
Convert a decreasing size 1 slice to an increasing one.
Convert, where possible, a sequence of integers to a slice.
These transformations are to allow subspacing on data objects that have restricted indexing functionality, such as
h5py.Variable
objects.If False then these transformations are not done.
- conform:
- Returns
Examples
>>> x.shape (12, 145, 192) >>> x.index() (slice(None), slice(None), slice(None)) >>> x = x[8:7:-1, 10:19:3, [15, 1, 4, 12]] >>> x = x[[0], [True, False, True], ::-2] >>> x.shape (1, 2, 2) >>> x.index() (slice(8, 9, None), slice(10, 17, 6), slice(12, -1, -11)) >>> x.index(conform=False) (array([8]), array([10, 16]), array([12, 1]))