Skip to content
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

Merged
merged 8 commits into from
Aug 22, 2024

Conversation

ValentinGebhart
Copy link
Collaborator

@ValentinGebhart ValentinGebhart commented Jul 31, 2024

Changes proposed in this PR:

  • new util module interpolate.py with which data can be linearly interpolated (and extrapolated) using the function interpolate_ev or interpolated with a stepfunction using the function stepfunction_ev. Options include thresholds and log scales. Also, a util function group_frequency is added to group frequencies for constant intensitity or impact values. These util functions will later be used in the functions Impact.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

PR Reviewer Checklist

@sarah-hlsn sarah-hlsn self-requested a review August 19, 2024 07:34
Copy link
Collaborator

@sarah-hlsn sarah-hlsn left a 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!

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


---

define fit functionalities for (local) exceedance frequencies and return periods
Copy link
Collaborator

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."?

Copy link
Collaborator Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# find indeces of x_test if sorted into x_train
# find indices of x_test if sorted into x_train

@ValentinGebhart ValentinGebhart merged commit b0f3a14 into develop Aug 22, 2024
16 of 17 checks passed
@ValentinGebhart ValentinGebhart deleted the feature/interp_util_func branch August 22, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants