nlmod.grid.aggregate_vector_per_cell groups by cellid only, so pieces of different features that share a cell are always merged. For boundary conditions that need per-feature budgets/boundnames (e.g. one RIV reach per lake per cell), the aggregation should first merge pieces of the same feature within a cell and keep features separate.
Current workaround in NHFLO/tools: nhflotools.lakes._aggregate_lake_cells loops groupby('identificatie') and calls aggregate_vector_per_cell once per feature — functional but O(n_features) calls and not reusable.
Proposal: a by= parameter, default 'cellid' (backward compatible), accepting ['cellid', '<boundname column>'] so the per-feature step becomes a one-liner. Related: #582 moves the lake piece→cell aggregation into lake_from_gdf; this issue is the generic primitive underneath it.
nlmod.grid.aggregate_vector_per_cellgroups bycellidonly, so pieces of different features that share a cell are always merged. For boundary conditions that need per-feature budgets/boundnames (e.g. one RIV reach per lake per cell), the aggregation should first merge pieces of the same feature within a cell and keep features separate.Current workaround in NHFLO/tools:
nhflotools.lakes._aggregate_lake_cellsloopsgroupby('identificatie')and callsaggregate_vector_per_cellonce per feature — functional but O(n_features) calls and not reusable.Proposal: a
by=parameter, default'cellid'(backward compatible), accepting['cellid', '<boundname column>']so the per-feature step becomes a one-liner. Related: #582 moves the lake piece→cell aggregation intolake_from_gdf; this issue is the generic primitive underneath it.