cf.Data.asdata

classmethod Data.asdata(d, dtype=None, copy=False)[source]

Convert the input to a Data object.

Parameters
d: data-like

Input data in any form that can be converted to an cf.Data object. This includes cf.Data and cf.Field objects, numpy arrays and any object which may be converted to a numpy array.

dtype: data-type, optional

By default, the data-type is inferred from the input data.

copy: TODO

Returns
Data

Data interpretation of d. No copy is performed on the input if it is already a Data object with matching dtype and copy is False.

Examples:

>>> d = cf.Data([1, 2])
>>> cf.Data.asdata(d) is d
True
>>> d.asdata(d) is d
True
>>> cf.Data.asdata([1, 2])
<CF Data: [1, 2]>
>>> cf.Data.asdata(numpy.array([1, 2]))
<CF Data: [1, 2]>