-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add the option to weight variable groups in ClimWIP #1856
Conversation
This first try runs for me. I'm doing some output checks now. @Peter9192: I decided to split the variable group loop in the main function, I hope that this does not create any unforeseen problems. My main intention there was to make sure that every element in the |
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 have tested this and the recipes fail when they should and work fine when everything is correct. But I cannot judge if having two loops over the variable_groups has any unforeseen implications.
Hey @Peter9192 ! |
Hey @lukasbrunner I was actually waiting with this one until #1864 was merged, to avoid any conflicts. But if it's completely independent, I can have a look now. |
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.
Hey @lukasbrunner ,
Personally I would like it if we calculate performance and independence for all variable groups, and then only apply the contributions weighting later, when we accumulate all variable groups. I can even imagine that you would change the relative contributions based on the intermediate results.
That said, I find your points between brackets quite convincing, so if you prefer to do it like this, that's fine with me. I tested the code and it seems to work fine. You can ignore my comments about the splitted loop then.
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Hey @Peter9192 Thanks for the review!! I think I addressed all your comments. I was a bit unsure how exactly to handle the complete skipping of either performance or independence weighting. For now I allow either not setting it at all or setting it to empty. I'm not sure it this creates any unforeseen problems but to me it seemed most intuitive like this. But I'm happy for any feedback. |
@lukasbrunner thanks for the changes. Before I have another look, could you please merge master into this branch? Now that #1864 is merged, we should solve any merge conflicts that might occur. |
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.
Hey @lukasbrunner ,
I think your approach is fine, and it works as far as I tested. Since the code changed quite a bit, the review has become bigger than I had expected. But it's considerably improved from the last round, so let's see if we can improve it still a bit more.
First, I left a couple of small suggestions. But then I came up with an idea and added some more suggestions. The point I'm trying to address is that, in the main function, you now have a couple of if statements that all use different criteria, and you loop over different lists. I think it would be nicer to have a single 'flag' or 'control variable' for those things, and I think you can use the performance_contributions and independence_contributions for that. I hope my idea is clear from the suggestions. If not, let me know.
PS I see the order of my comments is a bit messed up in the conversation view. Suggest to use the review tab to check them.
@@ -7,6 +7,7 @@ | |||
import os | |||
from collections import defaultdict | |||
from datetime import datetime | |||
from typing import Union |
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.
Should we add this as a direct dependency if we import it explicitly? @bouweandela
Also not sure if we want to go down this road with type hints. Any thoughts on this @bouweandela or @stefsmeets ?
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 was wondering if it is over the top... Although it IS nice to know that None explicitly is allowed. I'm fine with it either way
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.
It's up to @lukasbrunner, I'm fine with whatever works for you. The typing
module is part of the standard library, so there is no need to add it as a dependency. I would recommend running a test with mypy
to make sure that you got all the types right.
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Thanks again @Peter9192 ! I find these suggestions super helpful to improve my coding style, highly appreciated! I hope I did not overlook anything I could not accept all you your suggestion directly |
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.
Hey @lukasbrunner thanks again, I think you got everything.
1 small suggestion, and 1 more idea (only if you still feel like it):
Would it make sense to parse the sigmas together with the contributions? Then you catch the assertionerror from line 401 earlier in the diagnostic. Also it makes it easier for the reader, because these parsers let them view all the requirements for the recipe settings in one place (especially since these two are tightly connected).
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
Nice suggestion, thx! |
Okay cool, thanks for accepting all my changes. @bouweandela can you please do the bot magic again? I think I'm not allowed to.. or am I? |
@esmvalbot recipe_climwip.yml |
Okay one more quick fix. If one does not want to use performance weighting it is now possible to:
This Is this correct or should one of these cases not be allowed? In addition, if either of 1)-3) is true this line can be either commented out or left without a value:
|
@esmvalbot recipe_climwip.yml |
Starting recipe recipe_climwip.yml, output will be generated here |
Recipe recipe_climwip.yml ran OK, output has been generated here |
We're on a roll! 💪 |
@bouweandela ping 🔔 |
Tasks
yamllint
to check that your YAML files do not contain mistakesModified recipe/diagnostic
doc/sphinx/source/recipes
folderCloses #1853