cf.Data.__setitem__¶
-
Data.
__setitem__
(indices, value)[source]¶ Implement indexed assignment.
x.__setitem__(indices, y) <==> x[indices]=y
Assignment to data array elements defined by indices.
Elements of a data array may be changed by assigning values to a subspace. See
__getitem__
for details on how to define subspace of the data array.Note
Currently at most one dimension’s assignment index may be a 1-d array of integers or booleans. This is is different to
__getitem__
, which by default applies ‘orthogonal indexing’ when multiple indices of 1-d array of integers or booleans are present.Missing data
The treatment of missing data elements during assignment to a subspace depends on the value of the
hardmask
attribute. If it is True then masked elements will not be unmasked, otherwise masked elements may be set to any value.In either case, unmasked elements may be set, (including missing data).
Unmasked elements may be set to missing data by assignment to the
cf.masked
constant or by assignment to a value which contains masked elements.Performance
If the shape of the data is unknown then it is calculated immediately by executing all delayed operations.
If indices for two or more dimensions are lists or 1-d arrays of Booleans or integers, and any of these are dask collections, then these dask collections will be computed immediately.
See also
__getitem__
,__keedims_indexing__
,__orthogonal_indexing__
,cf.masked
,hardmask
,where