Fix #113: Prevent runtime warnings and NaNs in KPI cover factor calculations#116
Open
philippnim wants to merge 2 commits into
Open
Fix #113: Prevent runtime warnings and NaNs in KPI cover factor calculations#116philippnim wants to merge 2 commits into
philippnim wants to merge 2 commits into
Conversation
…lations Replaced direct division with `np.divide` to safely handle scenarios where the denominator for demand or supply cover factors is zero. This prevents `RuntimeWarning` and `NaN` values, ensuring defined outputs (1 for demand cover factor, 0 for supply cover factor) in these edge cases.
The calculation of annual demand and supply cover factors (dcf_year, scf_year) has been reworked. Instead of averaging cluster-level cover factors, the new approach aggregates weighted shared energy, total demand, and total supply across all clusters for a given year before calculating the overall annual factors. Additionally, residual load and injection from the energy hub is now included in the SCF and DCF calculations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#113
Replaced direct division with
np.divideto safely handle scenarios where the denominator for demand or supply cover factors is zero. This preventsRuntimeWarningandNaNvalues, ensuring defined outputs (1 for demand cover factor, 0 for supply cover factor) in these edge cases.