import dascore as dc
= dc.get_example_patch()
patch
# Concatenate patches along time axis
= dc.spool([patch, patch])
spool = spool.concatenate(time=None)
spool_concat assert len(spool_concat) == 1
# Concatenate patches along a new dimension.
# Note: This will only include the first patch if existing
# dimensions are not identical.
= spool.concatenate(wave_rank=None)
spool_concat assert "wave_rank" in spool_concat[0].dims
# Concatenate patches in groups of 3.
= dc.spool([patch] * 12)
big_spool = big_spool.concatenate(time=3)
spool_concat assert len(spool_concat) == 4
concatenate
concatenate(
self ,
check_behavior: Literal[‘warn’, ‘raise’, None] = warn,
**kwargs ,
)
Concatenate the patches together.
Only patches which are compatible with the first patch are concatenated together.
Parameters
Parameter | Description |
---|---|
check_behavior |
Indicates what to do when an incompatible patch is found in the spool. None will silently skip any incompatible patches,‘warn’ will issue a warning and then skip incompatible patches, ‘raise’ will raise an IncompatiblePatchError if any incompatible patches are found. |
**kwargs |
Used to specify the dimension and number of patches to merge together. A value of None attempts to concatenate all patches into as single patch. |
Examples
Note
Spool.chunk
performs a similar operation but accounts for coordinate values.- See also the chunk section of the spool tutorial