cf.Data.masked_all¶
-
classmethod
Data.masked_all(shape, dtype=None, units=None, calendar=None, chunks='auto')[source]¶ Return an empty masked array with all elements masked.
See also
- Parameters
- shape:
intortupleofint The shape of the new array. e.g.
(2, 3)or2.- dtype: data-type
The desired output data-type for the array, e.g.
numpy.int8. The default isnumpy.float64.- units:
strorUnits The units for the new data array.
- calendar:
str, optional The calendar for reference time units.
- chunks:
int,tuple,dictorstr, optional Specify the chunking of the underlying dask array.
Any value accepted by the chunks parameter of the
dask.array.from_arrayfunction is allowed.By default,
"auto"is used to specify the array chunking, which uses a chunk size in bytes defined by thecf.chunksizefunction, preferring square-like chunk shapes.- Parameter example:
A blocksize like
1000.- Parameter example:
A blockshape like
(1000, 1000).- Parameter example:
Explicit sizes of all blocks along all dimensions like
((1000, 1000, 500), (400, 400)).- Parameter example:
A size in bytes, like
"100MiB"which will choose a uniform block-like shape, preferring square-like chunk shapes.- Parameter example:
A blocksize of
-1orNonein a tuple or dictionary indicates the size of the corresponding dimension.- Parameter example:
Blocksizes of some or all dimensions mapped to dimension positions, like
{1: 200}, or{0: -1, 1: (400, 400)}.
New in version 3.14.0.
- shape:
- Returns
DataA masked array with all data masked.
Examples
>>> d = cf.Data.masked_all((2, 2)) >>> print(d.array) [[-- --] [-- --]]
>>> d = cf.Data.masked_all((), dtype=bool) >>> d.array masked_array(data=--, mask=True, fill_value=True, dtype=bool)