cf.Data.array

Data.array

A numpy array copy of the data.

In-place changes to the returned numpy array do not affect the underlying dask array.

The returned numpy array has the same mask hardness and fill values as the data.

Compare with compute.

Performance

array causes all delayed operations to be computed. The returned numpy array is a deep copy of that returned by created compute.

Examples

>>> d = cf.Data([1, 2, 3.0], 'km')
>>> a = d.array
>>> isinstance(a, numpy.ndarray)
True
>>> print(a)
[ 1.  2.  3.]
>>> d[0] = -99
>>> print(a[0])
1.0
>>> a[0] = 88
>>> print(d[0])
-99.0 km
>>> d = cf.Data('2000-12-1', units='days since 1999-12-1')
>>> print(d.array)
366
>>> print(d.datetime_array)
2000-12-01 00:00:00