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

Implement three levels of CMOR checks strictness #374

Merged
merged 64 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
547c9c5
ported Javi's functionality from dry checks to mainstream to be used …
valeriupredoi Nov 13, 2019
b693bc0
started work, committing quickly, laptop seems to be dying soon
valeriupredoi Nov 13, 2019
861a91c
talk to the Check
valeriupredoi Nov 13, 2019
b5b96b1
communication with the cmor checker
valeriupredoi Nov 13, 2019
9a6b264
implemented tiered errors
valeriupredoi Nov 13, 2019
a5b7680
rephrased a bit the error messages
valeriupredoi Nov 13, 2019
15919a7
Bouwe suggestion
valeriupredoi Nov 15, 2019
edd1f94
Bouwe suggestion
valeriupredoi Nov 15, 2019
0cabd66
replaced config key
valeriupredoi Nov 15, 2019
1c4701c
added default opt to cmd line
valeriupredoi Nov 15, 2019
30eee1d
fixed tests
valeriupredoi Nov 15, 2019
e71b6dc
fixed missing func arg
valeriupredoi Nov 15, 2019
694411b
fixed opt retrieval
valeriupredoi Nov 15, 2019
b1dfb51
Do not report anything in fix_metadata step
sloosvel Nov 15, 2019
bb70373
Relax some check_metadata checks
sloosvel Nov 15, 2019
3dee4ae
putting command line args dependent options in fix
valeriupredoi Nov 18, 2019
c7d75a3
making the implementation actually work
valeriupredoi Nov 18, 2019
847e8f1
adding func args
valeriupredoi Nov 18, 2019
c7971a5
fixed lines too long
valeriupredoi Nov 18, 2019
23e14de
fixed recipe tests
valeriupredoi Nov 18, 2019
0f9479d
fixed call to fix test
valeriupredoi Nov 18, 2019
f59418e
removed debug messgae
valeriupredoi Nov 18, 2019
f4ac790
Merge branch 'development' into cmor_checks_tiers
valeriupredoi Nov 18, 2019
bd9b4c9
Remove condition for regular errors
sloosvel Nov 25, 2019
4f6b6a4
Add unit tests
sloosvel Nov 26, 2019
06410b2
fixed linter
valeriupredoi Nov 29, 2019
57dd77b
fixed rank check
valeriupredoi Nov 29, 2019
3e27e49
Relax check on presence of some coordinates
sloosvel Dec 2, 2019
8f2e8dc
Fix style issues
sloosvel Dec 2, 2019
84ded5a
Add support for diferent error levels in checker
Dec 3, 2019
6addf1f
Remove unused import
Dec 3, 2019
c55a1ed
Fix codacy issues
Dec 3, 2019
ecc1062
fixed func attr
valeriupredoi Dec 3, 2019
aa48d92
fixed mock test
valeriupredoi Dec 3, 2019
70f64ce
proper fixed attr case is string
valeriupredoi Dec 3, 2019
f8584ce
fixed typo in func name
valeriupredoi Dec 3, 2019
a5885da
add time aux coords only if time in coords
valeriupredoi Dec 3, 2019
10ff62c
Clean a bit
Dec 3, 2019
d7d0561
added documentation on check levels
valeriupredoi Dec 3, 2019
9cbd895
added more meat to the check levels doc
valeriupredoi Dec 3, 2019
b9375aa
Doc update
Dec 3, 2019
dfb1e34
Rename check levels, keep only one ignore option
sloosvel Jan 27, 2020
2237941
Remove debug file
sloosvel Jan 27, 2020
7f04bae
Update documentation with name changes
sloosvel Jan 27, 2020
8c8b05c
Report warnings when converting units
sloosvel Jan 31, 2020
df2c681
Update doc/esmvalcore/fixing_data.rst
sloosvel Jan 31, 2020
8f33f02
Merge branch 'master' of https://github.com/ESMValGroup/ESMValCore in…
Feb 4, 2020
e27617c
Update docstrings
sloosvel Feb 19, 2020
9bcbf21
Merge branch 'master' into cmor_checks_tiers
sloosvel Feb 19, 2020
b218fb1
Attemp to fix conflicts
sloosvel Feb 25, 2020
1f45441
Update esmvalcore/cmor/check.py
sloosvel Feb 27, 2020
24c4cad
Update esmvalcore/cmor/check.py
sloosvel Feb 27, 2020
c0f4556
Update esmvalcore/cmor/check.py
sloosvel Feb 27, 2020
c3315a8
Update esmvalcore/cmor/check.py
sloosvel Feb 27, 2020
913e9b0
Update esmvalcore/cmor/fix.py
sloosvel Feb 27, 2020
8f83249
Update esmvalcore/cmor/fix.py
sloosvel Feb 27, 2020
91a205e
Update esmvalcore/cmor/check.py
sloosvel Feb 27, 2020
4e102d0
Apply suggestions from code review
sloosvel Feb 27, 2020
e0d9340
Improve warning message
sloosvel Feb 27, 2020
56ce2c2
Report missing coordinates with levels as critical
sloosvel Feb 27, 2020
1d5a0eb
Improve docstring
sloosvel Feb 27, 2020
87f34b8
Merge remote-tracking branch 'origin/master' into cmor_checks_tiers
sloosvel Feb 27, 2020
4c96139
Fix identation
sloosvel Feb 27, 2020
275d65c
Fix tests
sloosvel Feb 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions doc/esmvalcore/fixing_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,42 @@ missing coordinate you can create a fix for this model:
data_cube = cubes.extract_strict('VAR_NAME')
data_cube.add_aux_coord(coord, DIMENSIONS_INDEX_TUPLE)
return [data_cube]


Customizing checker strictness
==============================

The data checker classifies its issues using four different levels of
severity. From highest to lowest:

- ``CRITICAL``: issues that most of the time will have severe consequences.

- ``ERROR``: issues that usually lead to unexpected errors, but can be safely
ignored sometimes.

- ``WARNING``: something is not up to the standard but is unlikely to have
consequences later.

- ``DEBUG``: any info that the checker wants to communicate. Regardless of
checker strictness, those will always be reported as debug messages.

Users can have control about which levels of issues are interpreted as errors,
and therefore make the checker fail or warnings or debug messages.
For this purpose there is an optional command line option `--check-level`
that can take a number of values, listed below from the lowest level of
strictness to the highest:

- ``ignore``: all issues, regardless of severity, will be reported as
warnings. Checker will never fail. Use this at your own risk.

- ``relaxed``: only CRITICAL issues are treated as errors. We recommend not to
rely on this mode, although it can be useful if there are errors preventing
the run that you are sure you can manage on the diagnostics or that will
not affect you.

- ``default``: fail if there are any CRITICAL or ERROR issues (DEFAULT); Provides
a good measure of safety.

- ``strict``: fail if there are any warnings, this is the highest level of
strictness. Mostly useful for checking datasets that you have produced, to
be sure that future users will not be distracted by inoffensive warnings.
20 changes: 20 additions & 0 deletions esmvalcore/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from ._config import configure_logging, read_config_user_file, DIAGNOSTICS_PATH
from ._recipe import TASKSEP, read_recipe_file
from ._task import resource_usage_logger
from .cmor.check import CheckLevels

# set up logging
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -97,6 +98,24 @@ def get_args():
'--diagnostics',
nargs='*',
help="Only run the named diagnostics from the recipe.")
parser.add_argument(
'--check-level',
type=str,
choices=[
val.name.lower() for val in CheckLevels if val != CheckLevels.DEBUG
],
default='default',
help="""
Configure the severity of the errors that will make the CMOR check
fail.
Optional: true;
Possible values:
ignore: all errors will be reported as warnings
relaxed: only fail if there are critical errors
default: fail if there are any errors
strict: fail if there are any warnings
"""
)
args = parser.parse_args()
return args

Expand Down Expand Up @@ -142,6 +161,7 @@ def main(args):
pattern if TASKSEP in pattern else pattern + TASKSEP + '*'
for pattern in args.diagnostics or ()
}
cfg['check_level'] = CheckLevels[args.check_level.upper()]
cfg['synda_download'] = args.synda_download
for limit in ('max_datasets', 'max_years'):
value = getattr(args, limit)
Expand Down
3 changes: 3 additions & 0 deletions esmvalcore/_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ def _get_default_settings(variable, config_user, derive=False):
settings['fix_file']['output_dir'] = fix_dir
# Cube fixes
fix['frequency'] = variable['frequency']
fix['check_level'] = config_user['check_level']
settings['fix_metadata'] = dict(fix)
settings['fix_data'] = dict(fix)

Expand Down Expand Up @@ -328,13 +329,15 @@ def _get_default_settings(variable, config_user, derive=False):
'mip': variable['mip'],
'short_name': variable['short_name'],
'frequency': variable['frequency'],
'check_level': config_user['check_level']
}
# Configure final CMOR data check
settings['cmor_check_data'] = {
'cmor_table': variable['project'],
'mip': variable['mip'],
'short_name': variable['short_name'],
'frequency': variable['frequency'],
'check_level': config_user['check_level']
}

# Clean up fixed files
Expand Down
Loading