@@ -779,7 +779,9 @@ def get_effect_shares(
779779 if include_flows :
780780 if element not in self .components :
781781 raise ValueError (f'Only use Components when retrieving Effects including flows. Got { element } ' )
782- flows = self .components [element ].inputs + self .components [element ].outputs
782+ flows = [
783+ label .split ('|' )[0 ] for label in self .components [element ].inputs + self .components [element ].outputs
784+ ]
783785 return xr .merge (
784786 [ds ]
785787 + [
@@ -856,7 +858,9 @@ def _compute_effect_total(
856858 if include_flows :
857859 if element not in self .components :
858860 raise ValueError (f'Only use Components when retrieving Effects including flows. Got { element } ' )
859- flows = self .components [element ].inputs + self .components [element ].outputs
861+ flows = [
862+ label .split ('|' )[0 ] for label in self .components [element ].inputs + self .components [element ].outputs
863+ ]
860864 for flow in flows :
861865 label = f'{ flow } ->{ target_effect } ({ mode } )'
862866 if label in self .solution :
@@ -1267,16 +1271,6 @@ def __init__(
12671271 # Plot accessor for new plotting API
12681272 self .plot = ElementPlotAccessor (self )
12691273
1270- @property
1271- def _input_vars (self ) -> list [str ]:
1272- """Variable names for inputs (flow labels + |flow_rate suffix)."""
1273- return [f'{ label } |flow_rate' if '|' not in label else label for label in self .inputs ]
1274-
1275- @property
1276- def _output_vars (self ) -> list [str ]:
1277- """Variable names for outputs (flow labels + |flow_rate suffix)."""
1278- return [f'{ label } |flow_rate' if '|' not in label else label for label in self .outputs ]
1279-
12801274 def plot_node_balance (
12811275 self ,
12821276 save : bool | pathlib .Path = False ,
@@ -1510,14 +1504,14 @@ def plot_node_balance_pie(
15101504 dpi = plot_kwargs .pop ('dpi' , None ) # None uses CONFIG.Plotting.default_dpi
15111505
15121506 inputs = sanitize_dataset (
1513- ds = self .solution [self ._input_vars ] * self ._results .hours_per_timestep ,
1507+ ds = self .solution [self .inputs ] * self ._results .hours_per_timestep ,
15141508 threshold = 1e-5 ,
15151509 drop_small_vars = True ,
15161510 zero_small_values = True ,
15171511 drop_suffix = '|' ,
15181512 )
15191513 outputs = sanitize_dataset (
1520- ds = self .solution [self ._output_vars ] * self ._results .hours_per_timestep ,
1514+ ds = self .solution [self .outputs ] * self ._results .hours_per_timestep ,
15211515 threshold = 1e-5 ,
15221516 drop_small_vars = True ,
15231517 zero_small_values = True ,
@@ -1627,18 +1621,18 @@ def node_balance(
16271621 drop_suffix: Whether to drop the suffix from the variable names.
16281622 select: Optional data selection dict. Supports single values, lists, slices, and index arrays.
16291623 """
1630- ds = self .solution [self ._input_vars + self ._output_vars ]
1624+ ds = self .solution [self .inputs + self .outputs ]
16311625
16321626 ds = sanitize_dataset (
16331627 ds = ds ,
16341628 threshold = threshold ,
16351629 timesteps = self ._results .timesteps_extra if with_last_timestep else None ,
16361630 negate = (
1637- self ._output_vars + self ._input_vars
1631+ self .outputs + self .inputs
16381632 if negate_outputs and negate_inputs
1639- else self ._output_vars
1633+ else self .outputs
16401634 if negate_outputs
1641- else self ._input_vars
1635+ else self .inputs
16421636 if negate_inputs
16431637 else None
16441638 ),
@@ -1895,17 +1889,17 @@ def node_balance_with_charge_state(
18951889 """
18961890 if not self .is_storage :
18971891 raise ValueError (f'Cant get charge_state. "{ self .label } " is not a storage' )
1898- variable_names = self ._input_vars + self ._output_vars + [self ._charge_state ]
1892+ variable_names = self .inputs + self .outputs + [self ._charge_state ]
18991893 return sanitize_dataset (
19001894 ds = self .solution [variable_names ],
19011895 threshold = threshold ,
19021896 timesteps = self ._results .timesteps_extra ,
19031897 negate = (
1904- self ._output_vars + self ._input_vars
1898+ self .outputs + self .inputs
19051899 if negate_outputs and negate_inputs
1906- else self ._output_vars
1900+ else self .outputs
19071901 if negate_outputs
1908- else self ._input_vars
1902+ else self .inputs
19091903 if negate_inputs
19101904 else None
19111905 ),
0 commit comments