Skip to content

Commit

Permalink
Negative TC impacts: change method for centroid impacts by RP
Browse files Browse the repository at this point in the history
See issue #209

Changes method from line of best fit to linear interpolation.
  • Loading branch information
ChrisFairless committed Apr 15, 2021
1 parent 6b6b715 commit 6861d03
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions climada/engine/impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,15 +943,7 @@ def _cen_return_imp(imp, freq, imp_th, return_periods):
freq_cen = freq[imp_th]
if not imp_cen.size:
return np.zeros((return_periods.size,))
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
pol_coef = np.polyfit(np.log(freq_cen), imp_cen, deg=1)
except ValueError:
pol_coef = np.polyfit(np.log(freq_cen), imp_cen, deg=0)
imp_fit = np.polyval(pol_coef, np.log(1 / return_periods))
wrong_inten = (return_periods > np.max(1 / freq_cen)) & np.isnan(imp_fit)
imp_fit[wrong_inten] = 0.
imp_fit = np.interp(return_periods, 1/freq_cen, imp_cen)

return imp_fit

Expand Down

0 comments on commit 6861d03

Please sign in to comment.