-
Notifications
You must be signed in to change notification settings - Fork 89
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
Remove optional use of statsmodels within EMOS #1563
Remove optional use of statsmodels within EMOS #1563
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1563 +/- ##
==========================================
+ Coverage 97.93% 97.97% +0.03%
==========================================
Files 106 107 +1
Lines 9463 9562 +99
==========================================
+ Hits 9268 9368 +100
+ Misses 195 194 -1
Continue to review full report at Codecov.
|
I've created a PR-to-PR which changes this to make statsmodels required only for estimate EMOS functionality. That change avoids a hard dependency on statsmodels for all of IMPROVER but still allows for a lot of the simplification in this PR. I've also had a read through the this PR. All looks OK to me and avoiding two code paths is a nice simplification. |
Statsmodels required only for estimate EMOS
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.
A few questions
...er_tests/calibration/ensemble_calibration/test_EstimateCoefficientsForEnsembleCalibration.py
Show resolved
Hide resolved
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.
Thanks Gavin
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.
I've got a few questions about this PR, hopefully it is just my lack of understanding.
@@ -508,6 +484,7 @@ def setUp(self): | |||
halo surrounding the original data. | |||
Set up expected results for different situations. | |||
""" | |||
pytest.importorskip("statsmodels") |
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 statsmodels is no longer optional, why are we allowed to skip it?
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.
Thanks @MoseleyS. I think your queries are all related to @tjtg's PR to this PR (gavinevans#13). You're correct that this PR makes statsmodels no longer optional, however, as statsmodels is still only used in one particular place in the codebase, rather than having widespread usage like numpy or Iris, @tjtg has recommended that statsmodels is regarded as an optional module. I think this is a similar set-up to pysteps. Therefore, if someone wants to use components of improver, but isn't interested in EMOS, then they don't need to have statsmodels in their environment.
- statsmodels | ||
# Optional | ||
- numba | ||
- pysteps=1.4.1 | ||
- statsmodels |
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.
I think I need this explaining. The statsmodel dependency has moved from "Required" to "Optional", but the PR removes the optional status of this module, which I think makes it "Required".
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.
My previous understanding of "Required" and "Optional" was just like you suggest, which is why I made this PR: #1556. However, the preference, is to treat statsmodels more like pysteps, so even though it is required for EMOS, it is optional for the improver codebase, as someone might want to use improver, but not the EMOS component.
- statsmodels | ||
# Optional | ||
- numba | ||
- pysteps=1.4.1 | ||
- timezonefinder=4.1.0 |
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.
Why are these removed?
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.
There is an interest in representing different things with these different environments with this environment being slightly slimmer. This is the approach chosen by @tjtg in gavinevans#13.
@@ -994,6 +993,8 @@ def compute_initial_guess( | |||
List of coefficients to be used as initial guess. | |||
Order of coefficients is [alpha, beta, gamma, delta]. | |||
""" | |||
import statsmodels.api as sm |
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.
Why is this import statement not at the top of the file with all the other import statements?
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.
As mentioned above, this is because statsmodels is being treated as optional for the codebase, even though it is required for EMOS. Therefore, if someone isn't using the EMOS component of improver, then they can use a slimmer environment.
@@ -21,11 +21,7 @@ dependencies: | |||
- scipy=1.6 | |||
- sigtools | |||
- sphinx | |||
- statsmodels |
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.
Hi @tjtg. Can we add a comment to this environment stating what is NOT supported, so that we know what to expect. e.g.
# This environment does not support the following CLIs:
- estimate-emos-coefficients
- generate-timezone-mask-ancillary
- nowcast-accumulate
- nowcast-extrapolate
- nowcast-optical-flow-from-winds
- generate-advection-velocities-from-winds
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.
Approved. I will follow up on a comment in the environment as a separate PR when Tom has had a chance to respond to my question.
* Modifications to remove optional use of statsmodels. statsmodels is now a required module. * Run isort and black. * Flake8 corrections. * Flake8 correction. * Code and test changes to make statsmodels optional * Remove optional libraries from py38 environment * Move statsmodels to optional in py37 environment * Fix black * Re-add warning messages to be ignored. Co-authored-by: Tom Gale <[email protected]>
Addresses part of #1537
Description
This PR removes the optional use of statsmodels, meaning that it is now a required module. This aids the further development in #1537 for using a static additional predictor.
Further information in https://github.com/metoppv/mo-blue-team/issues/73#issuecomment-925092996.
Testing: