New interpolation util functionality by ValentinGebhart · Pull Request #930 · CLIMADA-project/climada_python
Conversation
Changes proposed in this PR:
- new util module
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
- Read the Contribution Guide
- Correct target branch selected (if unsure, select
develop) - Descriptive pull request title added
- Source branch up-to-date with target branch
- Documentation updated
- Tests updated
- Tests passing
- No new linter issues
- Changelog updated
PR Reviewer Checklist
- Read the Contribution Guide
- CLIMADA Reviewer Checklist passed
- Tests passing
- No new linter issues
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!
| 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. |
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. |
|
|
||
| --- | ||
|
|
||
| define fit functionalities for (local) exceedance frequencies and return periods |
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."?
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 :)
| 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 |
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 |
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