build_concat_plan

function of dascore.utils.chunk_plan source

build_concat_plan(
    df: DataFrame ,
    conflict: Literal[‘drop’, ‘raise’, ‘keep_first’] = raise,
    group = None,
    **kwargs ,
)-> ‘ChunkPlan’

Build a plan concatenating patches in order (Spool.concatenate).

Partitions as a chunk plan does — kind (the config’s attrs, a missing value matching anything), dimensions, the identity of every other dimension, and the concatenated dimension’s units (a patch with no values along it joins any) — and then groups each partition’s rows by the requested count in the order of the dimension (ascending or descending as the data run; given order when the rows have no envelope), with no sampling tolerance, no gap test, and no overlap removal. Patches which cannot be concatenated together land in separate outputs, never in an error. Remaining attributes must hold no conflicting known values within an output, policed by conflict exactly as a chunk plan polices them; non-dimensional coordinates are checked when the output is assembled.

Parameters

Parameter Description
df The flat patch relation to plan over.
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, ““) conflicts with nothing: the known value is
carried. History and the ids are never compared. If”raise” (default)
raise an AttributeMergeError
for conflicting known values. If “drop”, omit the conflicting attributes
from the output. If “keep_first”, keep the first known value of each.
group Attributes to partition on instead of the config’s patch_kind_attrs.
**kwargs One keyword naming the dimension and the number of patches per
output; None (or …) puts every patch of a partition in one
output. A dimension no patch has concatenates along a new one.