libera_utils.footprint_matching.aggregation.stack_product_values#
- libera_utils.footprint_matching.aggregation.stack_product_values(reader_cls: type[AncillaryReader], scalars: dict[str, float]) dict[str, float | np.ndarray]#
Shape one footprint’s per-spec scalars from one source into its product variables.
Each of the reader’s stacks (
reader_cls.product_stacks()) becomes one 1-D array holding its members’ scalars in coordinate order, the footprint’s row of a(time, dimension)product variable. Every scalar that is not a stack member is passed through as the 1-D product variable it already is.- Parameters:
reader_cls (type[AncillaryReader]) – The reader class whose product variables to shape.
scalars (dict[str, float]) –
{spec.name: scalar}for the footprint, asaggregate_sample_variables()returns it.
- Returns:
A float64 array of length
len(stack.members)under each stack’s name, and every unstacked scalar under its own name. Names are bare, as inscalars.- Return type:
- Raises:
ValueError – If
scalarslacks a member of one of the reader’s stacks, so a stacked variable would be missing a level.