chunk_plan

method of dascore.core.spool.Spool source

chunk_plan(
    self ,
    overlap: int | float | str | numpy.datetime64 | pandas.Timestamp | None[int, float, str, datetime64, Timestamp, None] = None,
    keep_partial: bool = False,
    snap_coords: bool = True,
    tolerance: float | pint.registry.Quantity | numpy.timedelta64[float, Quantity, timedelta64] = 1.5,
    conflict: Literal[‘drop’, ‘raise’, ‘keep_first’] = raise,
    group: str | collections.abc.Sequence[str, collections.abc.Sequence[str], None] = None,
    missing_dim: Literal[‘raise’, ‘drop’] = raise,
    fill_value = None,
    on_incomplete: Literal[‘warn’, ‘raise’, ‘ignore’] = raise,
    **kwargs ,
)

Return the plan chunk would execute, without touching any data.

The returned ChunkPlan is a read-only diagnostic: its outputs table describes each patch the chunked spool would contain (envelopes, step, carried attributes), its members table shows exactly which slice of which source patch feeds each output, and params records every resolved parameter (including the group attributes and sampling tolerance in effect). Accepts the same arguments as chunk. A dimension can be an (n, 2) array of absolute inclusive windows. Each requested window is checked against compatible source groups, and on_incomplete controls requests that cannot produce a complete output after keep_partial and the existing tolerance/fill rules are applied.

Examples

import dascore as dc
spool = dc.get_example_spool("random_das")
plan = spool.chunk_plan(time=3)
assert len(plan.outputs) == len(spool.chunk(time=3))
# See which sources contribute to the first output patch.
members = plan.members
first = members[members["output_id"] == 0]