classmethod Data.empty(shape, dtype=None, units=None, calendar=None, fill_value=None, chunks='auto')[source]

Return a new array of given shape and type, without initialising entries.

See also

full, ones, zeros

shape: int or tuple of int

The shape of the new array. e.g. (2, 3) or 2.

dtype: data-type

The desired output data-type for the array, e.g. numpy.int8. The default is numpy.float64.

units: str or Units

The units for the new data array.

calendar: str, optional

The calendar for reference time units.

chunks: int, tuple, dict or str, 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 the cf.chunksize function, 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 -1 or None 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.

fill_value: deprecated at version 3.14.0

Use set_fill_value instead.


Array of uninitialised (arbitrary) data of the given shape and dtype.


>>> d = cf.Data.empty((2, 2))
>>> print(d.array)
[[ -9.74499359e+001  6.69583040e-309],
 [  2.13182611e-314  3.06959433e-309]]         #uninitialised
>>> d = cf.Data.empty((2,), dtype=bool)
>>> print(d.array)
[ False  True]                                 #uninitialised