cf.Data.__array__¶
-
Data.
__array__
(*dtype)[source]¶ The numpy array interface.
New in version (cfdm): 1.7.0
- Parameters
- dtype: optional
Typecode or data-type to which the array is cast.
- Returns
numpy.ndarray
An independent numpy array of the data.
Examples:
>>> import numpy >>> d = cf.Data([1, 2, 3]) >>> a = numpy.array(d) >>> print(type(a)) <type 'numpy.ndarray'> >>> a[0] = -99 >>> d <CF Data(3): [1, 2, 3]> >>> b = numpy.array(d, float) >>> print(b) [ 1. 2. 3.]