quintel / etlocal

Regional data analysis tool for the Energy Transition Model
https://data.energytransitionmodel.com/
MIT License
2 stars 2 forks source link

Add possibility for nested combination methods #485

Closed redekok closed 9 months ago

redekok commented 10 months ago

The dataset amalgamator requires the definition of combination methods for all interface elements. If the values of an interface element can simply be added (by a regular sum) the combination method doesn't have to be defined explicitly. If any other method is required (average, weighted_average, ...) the combination method does have to be defined explicitly.

During the heat improvements project we have added and updated a couple of interface elements, including its combination methods. For the heat network distribution losses, we've encountered that the current combination methods that are available don't meet the need. When combining multiple datasets, the combined value of the heat network distribution loss should be a weighted average where the weight is the sum of multiple values (the steam hot water demand for district heating in the households sector, as well as those demands in the buildings and agricultural sector).

Hence, there is a need for nested combination methods, e.g.:

- header: energy_heat_distribution_loss
    combination_method:
      weighted_average:
        sum:
          - households_final_demand_steam_hot_water_demand 
          - buildings_final_demand_steam_hot_water_demand
          - agriculture_final_demand_steam_hot_water_demand 

It should also still be possible to pass multiple arguments to the weighted average, e.g.:

- header: energy_heat_distribution_loss
    combination_method:
      weighted_average:
        - sum:
          - households_final_demand_steam_hot_water_demand 
          - buildings_final_demand_steam_hot_water_demand
          - agriculture_final_demand_steam_hot_water_demand 
        - random_share

Similar to how Excel methods are defined and calculated, the most deeply nested method should be calculated first.

@thomas-qah and @noracato also curious what your thoughts are on this!

Notifying @Charlottevm