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, compared for equality, so a missing value is a value), dimensions, the identity of every other dimension, and how the concatenated dimension is spelled (its units and value kind; a patch with no values along it states neither, so it follows the one spelling the others share and forms its own group when they state two) — 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 equal 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, ““) 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 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.