import dascore as dc
spool = dc.get_example_spool()
# Concatenate every patch along time, contiguous or not.
merged = spool.concatenate(time=None)
assert len(merged) == 1
# Concatenate copies of a patch along a new dimension; patches
# sharing a new dimension must agree on the existing ones.
patch = dc.get_example_patch()
stacked = dc.spool([patch, patch.new()]).concatenate(wave_rank=None)
assert stacked[0].shape[stacked[0].get_axis("wave_rank")] == 2concatenate
concatenate(
self ,
check_behavior: Literal[‘warn’, ‘raise’, ‘ignore’] | None = None,
conflict: Literal[‘drop’, ‘raise’, ‘keep_first’] = raise,
group: str | collections.abc.Sequence[str, collections.abc.Sequence[str], None] = None,
**kwargs ,
)-> ‘Self’
Concatenate patches in order along a dimension.
Patches are partitioned using the compatibility rules from chunk, then joined in coordinate order, or spool order when no ordering is available. Incompatible patches form separate outputs. Conflicting attributes follow conflict; irreconcilable coordinates raise when an output loads.
Parameters
| Parameter | Description |
|---|---|
| check_behavior |
Deprecated and ignored (kept in its old place for callers who passed it positionally): patches which cannot be concatenated together are placed in separate outputs rather than skipped. |
| conflict |
Indicates how to handle attributes which hold conflicting values across the patches being combined (eg data_type, data_units, custom attrs). A missing value (None, NaN, ““) is a value like any other: it equals another missing one and nothing else, so a patch which never stated an attribute conflicts with one which did. History and the ids are never compared. If”raise” (default) raise an AttributeMergeError for conflicting values. If “drop”, omit the conflicting attributes from the output. If “keep_first”, keep the first patch’s value of each. |
| group |
Attributes which partition patches into separate outputs, instead of the config option patch_kind_attrs.
|
| **kwargs |
One keyword naming the dimension and the number of patches per output; None puts every patch of a partition in one output. Adimension no patch has concatenates along a new one. |
Examples
Note
Spool.chunkperforms a similar operation but accounts for coordinate values.concatenate_patchesconcatenates a list of patches directly, relative to the first.