Skip to content
Snippets Groups Projects
Commit dcdf332d authored by Paul Eckhardt's avatar Paul Eckhardt
Browse files

ADD: --ignore for rescode

CHANGE: change ignore_parameters to regular --ignore option
parent dd8fb0d5
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,8 @@ def add_private_args(parser, cmdline): # pylint: disable=W0613 ...@@ -76,7 +76,8 @@ def add_private_args(parser, cmdline): # pylint: disable=W0613
'--ignore', '--ignore',
type=ParseStrings(allow_scalar=True, allow_list=True, type=ParseStrings(allow_scalar=True, allow_list=True,
allowed_values=['numformat', 'dx0', allowed_values=['numformat', 'dx0',
'identical-values']), 'identical-values', 'parameter',
'rescode']),
default=[], default=[],
help='ignore certain errors while reading (numformat, dx0, ' help='ignore certain errors while reading (numformat, dx0, '
'identical-values)\n\n' 'identical-values)\n\n'
...@@ -91,7 +92,11 @@ def add_private_args(parser, cmdline): # pylint: disable=W0613 ...@@ -91,7 +92,11 @@ def add_private_args(parser, cmdline): # pylint: disable=W0613
'should be read, use this flag to downgrade the ERROR severity to ' 'should be read, use this flag to downgrade the ERROR severity to '
'WARNING. For the opposite (those cases are definitely identified as ' 'WARNING. For the opposite (those cases are definitely identified as '
'ERROR should not be read while the rest of the file should be read, ' 'ERROR should not be read while the rest of the file should be read, '
'consider the --skip-variables parameter)') 'consider the --skip-variables parameter)\n\n'
'parameter: ignore validity of parameters (component names or '
'component/matrix combination.\n\n'
'rescode: ignore wrong resolution codes (not consistent with '
'resolution of data).')
parser_nasa_group.add_argument( parser_nasa_group.add_argument(
'--skip-variables', '--skip-variables',
type=ParseIntegers(allow_scalar=True, allow_list=True, type=ParseIntegers(allow_scalar=True, allow_list=True,
...@@ -106,7 +111,6 @@ def add_private_args(parser, cmdline): # pylint: disable=W0613 ...@@ -106,7 +111,6 @@ def add_private_args(parser, cmdline): # pylint: disable=W0613
'start_time and end_time can not be skipped, numflags may not be ' 'start_time and end_time can not be skipped, numflags may not be '
'skipped') 'skipped')
parser_nasa_group.add_argument('--skip_unitconvert', action='store_true') parser_nasa_group.add_argument('--skip_unitconvert', action='store_true')
parser_nasa_group.add_argument('--ignore_parameter', action='store_true')
parser_nasa_group.add_argument( parser_nasa_group.add_argument(
'filenames', nargs='*', 'filenames', nargs='*',
help='input file(s), EBAS NASA-Ames format') help='input file(s), EBAS NASA-Ames format')
...@@ -248,12 +252,19 @@ def read_file(args, logger, filename): ...@@ -248,12 +252,19 @@ def read_file(args, logger, filename):
ignore_identicalvalues = False ignore_identicalvalues = False
if 'identical-values' in args.ignore: if 'identical-values' in args.ignore:
ignore_identicalvalues = True ignore_identicalvalues = True
ignore_parameter = False
if 'parameter' in args.ignore:
ignore_parameter = True
ignore_rescode = False
if 'rescode' in args.ignore:
ignore_rescode = True
skip_variables = [args.skip_variables] \ skip_variables = [args.skip_variables] \
if isinstance(args.skip_variables, int) else args.skip_variables if isinstance(args.skip_variables, int) else args.skip_variables
try: try:
nas.read(filename, skip_unitconvert=args.skip_unitconvert, nas.read(filename, skip_unitconvert=args.skip_unitconvert,
ignore_parameter=args.ignore_parameter, ignore_parameter=ignore_parameter,
ignore_rescode=ignore_rescode,
ignore_numformat=ignore_numformat, ignore_dx0=ignore_dx0, ignore_numformat=ignore_numformat, ignore_dx0=ignore_dx0,
ignore_identicalvalues=ignore_identicalvalues, ignore_identicalvalues=ignore_identicalvalues,
skip_variables=skip_variables) skip_variables=skip_variables)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment