-
Notifications
You must be signed in to change notification settings - Fork 48
Deprecate defining write_plots and write_netcdf in config-user file #808
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
Changes from all commits
9d40f74
5d9f66c
0c2dccf
ddd6e17
1a9d6dc
822afd5
6a0a73b
a63c460
053e097
0e8dba5
9ac52c6
29a944c
e9c00f1
c8c7f9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1219,13 +1219,20 @@ def _initialize_scripts(self, diagnostic_name, raw_scripts, | |
| for key in ( | ||
| 'output_file_type', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is enough to just mark the parameters as deprecated in the config and raise a warning. I think it would be better to keep this part of the code 'as-is' for now. The checks to re-add the keys below adds clutter. Save these for a later patch, and apply it to remove the parameters from the entire codebase for 2.3.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem with keeping this as is, is that the parameters from config-user.yml then overwrite what it says in the recipe, and people might get confused that it doesn't work if they add the setting in the recipe
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But if the warning is given for the config, then that should be enough in my opinion. Maybe it would be then a good idea to do a double check in the recipe runner and re-issue the warning there.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do you mean here by the 'recipe runner'? Wouldn't that result in the same amount of code clutter, but less user friendly?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I was thinking if that is the problem, we can also warn users as late as possible -- when the recipe is being executed by what I called the recipe runner 😅 I did not understand that the variables from the user config overwrite the recipe, which I guess is what added the complexity in the first place. Whatever is added here, we should make sure it is easy to undo. |
||
| 'log_level', | ||
| 'write_plots', | ||
| 'write_netcdf', | ||
| 'profile_diagnostic', | ||
| 'auxiliary_data_dir', | ||
| ): | ||
| settings[key] = self._cfg[key] | ||
|
|
||
| # Add deprecated settings from configuration file | ||
| # DEPRECATED: remove in v2.4 | ||
| for key in ( | ||
| 'write_plots', | ||
| 'write_netcdf', | ||
| ): | ||
| if key not in settings and key in self._cfg: | ||
| settings[key] = self._cfg[key] | ||
|
|
||
| scripts[script_name] = { | ||
| 'script': script, | ||
| 'output_dir': settings['work_dir'], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,8 +377,6 @@ def _write_ncl_settings(self): | |
| 'work_dir', | ||
| 'output_file_type', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, don't delete these variables just yet and remove the block to add them back below.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some change is needed here, because otherwise these settings will not be available as variable |
||
| 'log_level', | ||
| 'write_plots', | ||
| 'write_netcdf', | ||
| } | ||
| settings = {'diag_script_info': {}, 'config_user_info': {}} | ||
| for key, value in self.settings.items(): | ||
|
|
@@ -389,6 +387,13 @@ def _write_ncl_settings(self): | |
| else: | ||
| settings[key] = value | ||
|
|
||
| # Still add deprecated keys to config_user_info to avoid | ||
| # crashing the diagnostic script that need this. | ||
| # DEPRECATED: remove in v2.4 | ||
| for key in ('write_plots', 'write_netcdf'): | ||
| if key in self.settings: | ||
| settings['config_user_info'][key] = self.settings[key] | ||
|
|
||
| write_ncl_settings(settings, filename) | ||
|
|
||
| return filename | ||
|
|
@@ -560,9 +565,7 @@ def _collect_provenance(self): | |
| 'recipe', | ||
| 'run_dir', | ||
| 'version', | ||
| 'write_netcdf', | ||
| 'write_ncl_interface', | ||
| 'write_plots', | ||
| 'work_dir', | ||
| ) | ||
| attrs = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.