Exemplo n.º 1
0
from pyorac.colour_print import colour_print
from pyorac.definitions import COLOURING, OracError, OracWarning
from pyorac.run import process_all
from pyorac.util import warning_format

import warnings
warnings.formatwarning = warning_format
warnings.filterwarnings('always', category=OracWarning)

# Define parser
pars = ArgumentParser(
    description='Run the full ORAC suite on a given Level 1B file.')
pars.add_argument('target', type=str, help='Level 1B file to be processed')
args_common(pars)
args_cc4cl(pars)
args_preproc(pars)
args_main(pars)
args_postproc(pars)
args = pars.parse_args()

try:
    jid, _ = process_all(args)

    if args.script_verbose and args.batch:
        print("Job queued with ID {}".format(jid))

except OracError as err:
    colour_print('ERROR) ' + str(err), COLOURING['error'])
except KeyboardInterrupt:
    colour_print('Execution halted by user.', COLOURING['error'])
Exemplo n.º 2
0
try:
    for test in orig_args.tests:
        colour_print(test, COLOURING['header'])
        args = deepcopy(orig_args)

        # Set filename to be processed and output folder
        args.out_dir = os.path.join(base_out_dir, test)
        try:
            args.target, args.limit, args.preset_settings = REGRESSION_TESTS[test]
        except KeyError:
            raise OracError("Invalid regression test for given phases.")

        args.preset_settings += "_" + args.test_type

        jid, out_file = process_all(args)
        log_path = os.path.join(args.out_dir, log_dir)

        # Check for regressions
        if not args.benchmark and not args.dry_run:
            inst = FileName(args.out_dir, out_file)
            if not args.batch:
                args = check_args_common(args)
                args = check_args_preproc(args)
                try:
                    run_regression(inst)
                except Regression as err:
                    colour_print('REGRESSION) ' + str(err), COLOURING['error'])

            else:
                if os.path.isdir(os.path.join(defaults.orac_dir, "tools")):