cf.Data.concatenate

classmethod Data.concatenate(data, axis=0, cull_graph=True)[source]

Join a sequence of data arrays together.

See also

cull_graph

Parameters
data: sequence of Data

The data arrays to be concatenated. Concatenation is carried out in the order given. Each data array must have equivalent units and the same shape, except in the concatenation axis. Note that scalar arrays are treated as if they were one dimensional.

axis: int, optional

The axis along which the arrays will be joined. The default is 0. Note that scalar arrays are treated as if they were one dimensional.

Note

If the axis specified is cyclic, it will become non-cyclic in the output.

cull_graph: bool, optional

By default cull_graph is True, meaning that unnecessary tasks are removed (culled) from each array’s dask graph before concatenation. This process has a small overhead but can improve performance overall. If set to False then dask graphs are not culled. See dask.optimization.cull for details.

New in version 3.14.0.

Returns
Data

The concatenated data.

Examples

>>> d = cf.Data([[1, 2], [3, 4]], 'km')
>>> e = cf.Data([[5.0, 6.0]], 'metre')
>>> f = cf.Data.concatenate((d, e))
>>> print(f.array)
[[ 1.     2.   ]
 [ 3.     4.   ]
 [ 0.005  0.006]]
>>> f.equals(cf.Data.concatenate((d, e), axis=-2))
True
>>> e = cf.Data([[5.0], [6.0]], 'metre')
>>> f = cf.Data.concatenate((d, e), axis=1)
>>> print(f.array)
[[ 1.     2.     0.005]
 [ 3.     4.     0.006]]
>>> d = cf.Data(1, 'km')
>>> e = cf.Data(50.0, 'metre')
>>> f = cf.Data.concatenate((d, e))
>>> print(f.array)
[ 1.    0.05]
>>> e = cf.Data([50.0, 75.0], 'metre')
>>> f = cf.Data.concatenate((d, e))
>>> print(f.array)
[ 1.     0.05   0.075]