-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently, the scale_add function transfers quantities between elements in a FoodBalanceSheet dataset, but doesn't pay much attention to element_out after the delta has been added or subtracted.
Something I've found myself doing very often is to check whether any quantity in element_out falls below zero. This is useful if, for instance, negative quantities do not make sense and / or the excess must be transferred to another element
ds_out = ds.fbs.scale_add(element_in="food", element_out="production", scale=scale, items=items)
excess = ds_out["production"].where(ds_out["production"] < 0, other=0)
ds_out["production"] -= excess
ds_out["imports"] += excessAn "excess" or "fallback" parameter could be used to transfer these quantities to an alternative element, in a similar way to the balanced_scaling model we already have.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels