Skip to content

Commit

Permalink
Add financial_losses_pp to PowerPlants assets.
Browse files Browse the repository at this point in the history
Co-authored-by: Arfima Dev <[email protected]>
Co-authored-by: Jose M. Cano <[email protected]>
Signed-off-by: Jonathan Yanez Vargas <[email protected]>
  • Loading branch information
3 people committed Aug 8, 2024
1 parent 6551d5c commit 86f2bae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Contributors
* Arfima Dev <[email protected]>
* Gonzalo Álvarez <[email protected]>
* Jonathan Yánez <[email protected]>
* Jose M. Cano <[email protected]>
* Víctor de Luna <[email protected]>
* Virginia Morales <[email protected]>
* Xavier Barrachina <[email protected]>
11 changes: 3 additions & 8 deletions src/osc_physrisk_financial/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def financial_losses(
energy_price: float,
r: Sequence[float],
n: Optional[int] = 1,
) -> DiscreteRandomVariable:
) -> Union[DiscreteRandomVariable, float]:
r"""Compute financial losses for a PowerPlant asset.
Parameters
Expand Down Expand Up @@ -333,10 +333,5 @@ def financial_losses(
"""
scaled_values = (
damages.values * self.value_0 * energy_price * self.discount(r, n)
)
res = DiscreteRandomVariable(
values=scaled_values, probabilities=damages.probabilities.tolist()
)
return res
return self.value_0 * self.discount(r, n) * energy_price * damages
# TODO SHOULD BE return self.cash_flows * self.discount(r, n)
1 change: 0 additions & 1 deletion src/osc_physrisk_financial/random_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ def __init__(
"Impact bins must be sorted in non-decreasing order."
)
total_prob = np.sum(probabilities_np)
print(total_prob)
if not np.isclose(total_prob, 1):
if 0 in intervals_np:
zero_index = np.where(intervals_np == 0)[0][0]
Expand Down

0 comments on commit 86f2bae

Please sign in to comment.