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

Change lmoments3 behaviour with fitkwargs #2045

Merged
merged 26 commits into from
Feb 13, 2025
Merged

Change lmoments3 behaviour with fitkwargs #2045

merged 26 commits into from
Feb 13, 2025

Conversation

coxipi
Copy link
Contributor

@coxipi coxipi commented Jan 13, 2025

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGELOG.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Add a warning if fitkwargs is given with lmoments method
  • Except if we use the gamma distribution is used with floc: This is accepted and used to shift the distribution

Does this PR introduce a breaking change?

No

Other information:

I realize that SPI/SPEI is still heavily constrained in what distribution can be used. For now, only gamma/fisk (log-logistic) are allowed. At some point we could revisit this. I think we reached a point where we could be more permissive, since we ironed out many of the potential problems in these functions. There is still potential that problems could arise if we allow more distributions, but we might have to accept that some problems might arise when working with these optimization procedures, and fix them on the fly (or not, if it's just a limitation of the method).

@coxipi
Copy link
Contributor Author

coxipi commented Jan 14, 2025

@aulemahal Sascha suggested an error instead of a warning, thoughts? Sometimes I'm not sure which is more appropriate

Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

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

I was thinking of a warning because I was thinking of a usage where one calls the function multiple time with different distributions but the same other arguments. I realize now that this does not make much sense, woups.

Thinking of it, an error might indeed be better. Sorry for the confusion!

@github-actions github-actions bot added the approved Approved for additional tests label Jan 14, 2025
@github-actions github-actions bot added the indicators Climate indices and indicators label Jan 14, 2025
@coxipi
Copy link
Contributor Author

coxipi commented Jan 14, 2025

Now, we can use PWM in SPI/SPEI functions directly.

I added tests: The results with lmoments3 (PWM) / gamma is close to what we get with ML/gamma or APP/gamma, so I'm satisfied, things work well.

@coveralls
Copy link

coveralls commented Jan 20, 2025

Coverage Status

coverage: 89.936% (-0.04%) from 89.974%
when pulling d3b6204 on fitkwargs_lmoments
into 3152070 on main.

@coxipi
Copy link
Contributor Author

coxipi commented Feb 11, 2025

rv_continuous now allowed generally, with the usual constraints remaining with a the use of a string.

Should be good to go, let's see the tests

@coxipi coxipi merged commit 871a5b8 into main Feb 13, 2025
21 checks passed
@coxipi coxipi deleted the fitkwargs_lmoments branch February 13, 2025 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests indicators Climate indices and indicators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants