Once a spool carries an inventory, the fields that inventory defines should be selectable, and today they are not: spool.attach_inventory(inv).select(coupling="cement") raises InvalidSpoolQueryError because the index has no such column. The spec (API/spool.qmd) documents this workflow, so the gap is between the design and the implementation rather than in the design.
Two levels, with quite different mechanics:
Acquisition-level (whole patch). Fields of the acquisition or interrogator — gauge_length, interrogator.model. A patch matches or it does not. Resolution is pure metadata: for each distinct data_source_id and time window in the index, resolve the acquisition, test the predicate, keep or drop the row. No patch data is loaded and len(spool) stays exact.
Channel-level (within a patch). Track fields (coupling.medium), annotation groups (zone), geometry axes (latitude, z), and optical distance. These select a set of channels, which may be disjoint along the fiber, so a matching patch is trimmed and sometimes subdivided. That changes the number of patches, so it cannot be answered from the index alone; it needs a resolution pass over the inventory per row. prune_to_inventory (below) is the natural place for that pass, since it is already the documented one-time metadata cost.
What comes back on the patch. A name used in a select should arrive on the extracted patch, and nothing more: select(coupling="cement") yields patches carrying coupling.medium so the result says why each channel survived, without paying for blanket enrichment. Composed with an explicit Spool.enrich, the patch owes the union of what was asked for.
Related and not yet implemented:
Spool.prune_to_inventory(inventory=None) — resolve the index against the inventory, drop rows it does not describe (on_missing of raise/warn/drop), and subdivide rows straddling an epoch boundary.
- Lazy attachment:
attach_inventory should accept a path and not read it until something needs it, plus an auto-attach from a blessed name in a spool directory. This depends on the authoring-format loader, which does not exist yet.
Spool.select currently adds a note to its error naming the attached inventory and saying this is not supported yet, so the failure at least points somewhere useful.
Once a spool carries an inventory, the fields that inventory defines should be selectable, and today they are not:
spool.attach_inventory(inv).select(coupling="cement")raisesInvalidSpoolQueryErrorbecause the index has no such column. The spec (API/spool.qmd) documents this workflow, so the gap is between the design and the implementation rather than in the design.Two levels, with quite different mechanics:
Acquisition-level (whole patch). Fields of the acquisition or interrogator —
gauge_length,interrogator.model. A patch matches or it does not. Resolution is pure metadata: for each distinctdata_source_idand time window in the index, resolve the acquisition, test the predicate, keep or drop the row. No patch data is loaded andlen(spool)stays exact.Channel-level (within a patch). Track fields (
coupling.medium), annotation groups (zone), geometry axes (latitude,z), and opticaldistance. These select a set of channels, which may be disjoint along the fiber, so a matching patch is trimmed and sometimes subdivided. That changes the number of patches, so it cannot be answered from the index alone; it needs a resolution pass over the inventory per row.prune_to_inventory(below) is the natural place for that pass, since it is already the documented one-time metadata cost.What comes back on the patch. A name used in a select should arrive on the extracted patch, and nothing more:
select(coupling="cement")yields patches carryingcoupling.mediumso the result says why each channel survived, without paying for blanket enrichment. Composed with an explicitSpool.enrich, the patch owes the union of what was asked for.Related and not yet implemented:
Spool.prune_to_inventory(inventory=None)— resolve the index against the inventory, drop rows it does not describe (on_missingofraise/warn/drop), and subdivide rows straddling an epoch boundary.attach_inventoryshould accept a path and not read it until something needs it, plus an auto-attach from a blessed name in a spool directory. This depends on the authoring-format loader, which does not exist yet.Spool.selectcurrently adds a note to its error naming the attached inventory and saying this is not supported yet, so the failure at least points somewhere useful.