New interpolation util functionality#930
Merged
ValentinGebhart merged 8 commits intodevelopfrom Aug 22, 2024
Merged
Conversation
sarah-hlsn
approved these changes
Aug 21, 2024
Collaborator
sarah-hlsn
left a comment
There was a problem hiding this comment.
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. |
Collaborator
There was a problem hiding this comment.
Suggested change
| 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 |
Collaborator
There was a problem hiding this comment.
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."?
Collaborator
Author
There was a problem hiding this comment.
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 |
Collaborator
There was a problem hiding this comment.
Suggested change
| # find indeces of x_test if sorted into x_train | |
| # find indices of x_test if sorted into x_train |
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.
Changes proposed in this PR:
interpolate.pywith which data can be linearly interpolated (and extrapolated) using the functioninterpolate_evor interpolated with a stepfunction using the functionstepfunction_ev. Options include thresholds and log scales. Also, a util functiongroup_frequencyis 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