-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New interpolation util functionality #930
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from a few typos and a minor suggestion this looks all good to me!
climada/util/interpolation.py
Outdated
logx : bool, optional | ||
If set to True, x_values are convert to log scale. Defaults to False. | ||
logy : bool, optional | ||
If set to True, x_values are convert to log scale. Defaults to False. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If set to True, x_values are convert to log scale. Defaults to False. | |
If set to True, y_values are convert to log scale. Defaults to False. |
climada/util/interpolation.py
Outdated
|
||
--- | ||
|
||
define fit functionalities for (local) exceedance frequencies and return periods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line supposed to be here? As it is now I don't find it very explanatory for an external user. It's a matter of taste I guess but maybe something around the lines of: "Define interpolation and extrapolation functions for calculating (local) exceedance frequencies and return periods."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, I believe this was the description of the original PR, now it should be adapted as you say :)
climada/util/interpolation.py
Outdated
if x_train.size < 2: | ||
return _interpolate_small_input(x_test, x_train, y_train, None, y_asymptotic) | ||
|
||
# find indeces of x_test if sorted into x_train |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# find indeces of x_test if sorted into x_train | |
# find indices of x_test if sorted into x_train |
Changes proposed in this PR:
interpolate.py
with which data can be linearly interpolated (and extrapolated) using the functioninterpolate_ev
or interpolated with a stepfunction using the functionstepfunction_ev
. Options include thresholds and log scales. Also, a util functiongroup_frequency
is added to group frequencies for constant intensitity or impact values. These util functions will later be used in the functionsImpact.local_exceedance_impact
,Hazard.local_exceedance_intensity
,Hazard.local_return_period
, see PR Combining several interpolation functions using a new util function #918.This PR is the first part of PR #918 (splitted for length reasons) that will fix #904, #915 and partially also #209.
PR Author Checklist
develop
)PR Reviewer Checklist