cf.Data.zeros¶

classmethod
Data.
zeros
(shape, dtype=None, units=None, calendar=None, chunks='auto')[source]¶ Returns a new array filled with zeros of set shape and type.
 Parameters
 shape:
int
ortuple
ofint
The shape of the new array.
 dtype: datatype
The datatype of the new array. By default the datatype is
float
. units:
str
orUnits
The units for the new data array.
 calendar:
str
, optional The calendar for reference time units.
 chunks:
int
,tuple
,dict
orstr
, optional Specify the chunking of the underlying dask array.
Any value accepted by the chunks parameter of the
dask.array.from_array
function is allowed.By default,
"auto"
is used to specify the array chunking, which uses a chunk size in bytes defined by thecf.chunksize
function, preferring squarelike 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 blocklike shape, preferring squarelike chunk shapes. Parameter example:
A blocksize of
1
orNone
in 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
Data
Array of zeros with the given shape and data type.
Examples
>>> d = cf.Data.zeros((2, 3)) >>> print(d.array) [[0. 0. 0.] [0. 0. 0.]]
>>> d = cf.Data.zeros((2,), dtype=bool) >>> print(d.array) [False False]