-
Notifications
You must be signed in to change notification settings - Fork 36
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
Added option to explicitly not use fx variables in preprocessors #1416
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1416 +/- ##
==========================================
+ Coverage 88.86% 88.87% +0.01%
==========================================
Files 196 196
Lines 9965 9971 +6
==========================================
+ Hits 8855 8862 +7
+ Misses 1110 1109 -1
Continue to review full report at Codecov.
|
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 don't think this should introduce a backwards incompatible change, the behaviour of regular masks should not change - afaik for the previous implementation for mask_landsea/mask_seaice if there were no fx_variables specified by the user it'd try sflf/sftof/sftgif and if those are not found then it'd go straight to NE masks - if this is not the case then I have a big beef if it's choosing its own system fx variables
doc/recipe/preprocessor.rst
Outdated
@@ -247,6 +247,13 @@ available tables of the specified project. | |||
a given dataset) fx files are found in more than one table, ``mip`` needs to | |||
be specified, otherwise an error is raised. | |||
|
|||
.. note:: | |||
To explicitly **not** use any fx variables in a preprocessor, use either | |||
``fx_variables: null``, ``fx_variables: {}`` or ``fx_variables: []``. While |
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 find it confusing to have multiple options for the same functionality - decide which one single one you like and use only that, you can be fancy and add a catchment in the recipe parser eg if fx_variables == {} or fx_variables == []: raise RecipeError("I see you are trying to be smart, use null for fx_variables, smartypants")
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.
Right now we allow dicts
and lists
for fx variables (see here), so I think at least an empty list
and an empty dict
should be allowed. For me it feels natural to also inlcude fx_variables=None
, but I can remove that if necessary π
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 am more in favour of Null
or None
only - think from a user's perspective and not from the developer's perspective - how nice is it when you read the Numpy docs and they simply say set this to Null if you don't want to have it
rather than you can call your grandfather Grampa, Gramps, as well as Granddad, as well as Pops etc
... UX first, ma man
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.
How about we allow all of them but just mention fx_variables: null
in the doc?
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.
sounds very good to me πΊ
Here's a summary of the old/new behavior:
As you can see, only the behavior of using EDIT: The main change in this PR is moving from a |
nice summary! so then there is no actual case of backwards incompatibility but rather the existence of a hidden feature in the case of |
What if only a few data sources are missing the files? If I add the new option, will all fx files be ignored, even those that are present? |
yep |
Do we want that? |
Well technically it is backwards incompatible, but the feature that changes has never been used before, so I guess it shouldn't be a big deal. However, if one needs a common land/sea mask for a bunch of datasets (previously using the
Yes, if you explicitly add the new option, all fx files are ignored. I don't think it's a problem since the user actively has to change that and if a preprocessor needs fx files in order to work (e.g., |
not really no, but that's up to the user to decide methinks - they do a first run without |
We allow the user to choose custom fx_variables for the preprocessor right now (I could use e.g. |
I am thinking of the following. Say you want to plot tas in maps for a bunch of models, but only over land, so you use mask_landsea. For good measure, you throw in ICON or some satellite product that doesn't have a mask. ESMValTool barfs with missing fx file and you add the new option. But suddenly all your nice working model masks are gone and you get artifact galore close to the coasts. |
Yeah see I don't like this - this is a recipe for inconsistent results, useless panicking of the UX group (moar incompatible changes!), and something that is not that helpful in the case of those preprocessors anyway since if sftlf/of/gif data is missing people have already gotten used to the machinery switching to NE masks. To be clear, all I want for Christmas is you (to remove those backwards incompatible change messages, no actual change of the functionality) π |
Very good point @zklaus ! yes, NE masks only for ICON and sft's for models - another good argument to remove the messages about the option for |
I completely understand that sometimes this can be problematic (that's why I added the "not encouraged" in the doc). However, as I already mentioned in the description of this PR, I don't want to make a case for using/not using fx files. I just want a consistent behavior of the tool, which is not the case at the moment imho. Why would |
Haha, yes, done π |
Agreed. We really should think a bit about what we really should be doing here before we throw on a few more layers of confusion. |
To be honest I think that this change rather removes a layer of confusion. When I read the doc about fx variables in preprocessors and found something like:
I thought: "hey, if I use |
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.
cheers for the work, Manu! I'm ok with it as it is now, so am off on baby Jesus holidays starting in 30min so approving not to be the cork in the bottle, you settle if there's other things with Klaus, I'll see you guys back in January, happy holidays!! π π
@zklaus is there anything I can change to find a compromise here? |
Oh well, I suppose it doesn't make the situation much worse. At some point, we'll have to overhaul this situation, but then let's focus on the details of this PR for now. One thing that sticks out to me is the deprecation exception. Probably that should at least go to |
Sounds good to me!
Yes, I will move it to I basically copy-pasted this from here ESMValCore/esmvalcore/experimental/config/_config_validators.py Lines 18 to 20 in b070a4b
and here Apparently I think the approach of this PR is easier (since it doesn't rely on the extra |
Hm. I long term, as part of our backwards compatibility efforts, I think we want to catch all deprecations from ourselves and our dependencies. That will mean automatic collections of all deprecations during the test runs in the CI context of ESMValTool. If our own approach to deprecation handling aligns with the rest of the ecosystem, it should be much easier to get a quick overview. At least I'd like to hear some other opinions before we introduce a completely new mechanism for deprecations. @ESMValGroup/esmvaltool-coreteam, any views on deprecation by custom exception? |
Just for reference: If this is an issue, I can just use the "old" approach. As I said, I just copy-pasted this from other parts of our code and thought it will be fine. Nevertheless, I don't really understand the problem here. We don't have this automatic collection of all deprecations in place yet and I don't really think it will be a problem if we use a custom warning here that (1) inherits from |
as long as we don't have a standard deprecation handler yet (we should have one soon!) I am fine with this - it's verbosy and user-friendly enough to me; one thing I'd suggest is not to take what |
Any further comments on this? I really would like to get this in, soon. Cheers! |
@zklaus maybe some final (or not so final π ) remarks so we can get this over the hill? πΊ |
Actually, I have to apologize a little bit. I read the So go ahead. Perhaps it's a good idea to open an issue about adding a "canonical" approach to deprecations to the documentation? |
No worries, thanks for the review! I will open an issue about that π |
Description
This PR allows the use of
fx_variables: {}
(orfx_variables: null
orfx_variables: []
) to not use any fx variables in the preprocessor.Deprecations
In addition, it deprecates the option
always_use_ne_masks=True
for themask_landsea
preprocessor. The same behavior can now be achieved by usingfx_variables: {}
.Closes #1415
Link to documentation:
Before you get started
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the π Technical or π§ͺ Scientific review.
π Changes are backward compatibleTo help with the number pull requests: