@@ -3,7 +3,7 @@ use crate::commodity::{CommodityID, CommodityMap, CommodityType};
33use crate :: process:: { ProcessID , ProcessMap } ;
44use crate :: region:: RegionID ;
55use crate :: time_slice:: { TimeSliceInfo , TimeSliceLevel , TimeSliceSelection } ;
6- use crate :: units:: Dimensionless ;
6+ use crate :: units:: { Dimensionless , Flow } ;
77use anyhow:: { Context , Result , anyhow, ensure} ;
88use indexmap:: IndexSet ;
99use itertools:: { Itertools , iproduct} ;
@@ -198,12 +198,10 @@ fn prepare_commodities_graph_for_validation(
198198 // NOTE: we only do this for commodities with the same time_slice_level as the selection
199199 let demand_node_index = filtered_graph. add_node ( GraphNode :: Demand ) ;
200200 for ( commodity_id, commodity) in commodities {
201- if time_slice_selection. level ( ) == commodity. time_slice_level
202- && commodity. demand . contains_key ( & (
203- region_id. clone ( ) ,
204- year,
205- time_slice_selection. clone ( ) ,
206- ) )
201+ if commodity
202+ . demand
203+ . get ( & ( region_id. clone ( ) , year, time_slice_selection. clone ( ) ) )
204+ . is_some_and ( |& v| v > Flow ( 0.0 ) )
207205 {
208206 let commodity_node = GraphNode :: Commodity ( commodity_id. clone ( ) ) ;
209207 let commodity_node_index = filtered_graph
0 commit comments