How to use the tonic.models.vic.vic.VIC function in tonic

To help you get started, we’ve selected a few tonic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UW-Hydro / VIC / tests / run_profiling.py View on Github external
def run_scaling(args):
    '''wrapper function for scaling tests'''
    config = hosts[args.host]
    vic_exe = VIC(args.vic_exe)

    # write timing file header
    header = string.Template(table_header)
    header_kwargs = get_header_info(args.vic_exe, args.global_param)
    header = header.safe_substitute(**header_kwargs)
    with open(args.timing, 'w') as f:
        f.write(header)

    for i, kwargs in enumerate(config.profile):
        if config.template:
            # run on a cluster of some kind
            # start by printing the template
            print('-'.ljust(OUT_WIDTH, '-'))
            print('{host} template'.format(
                host=args.host).center(OUT_WIDTH))
            print('-'.ljust(OUT_WIDTH, '-'))
github UW-Hydro / VIC / tests / run_tests.py View on Github external
os.makedirs(out_dir, exist_ok=True)

    # Validate input directories
    if not (len(args.tests) == 1 and args.tests[0] == 'unit'):
        for d in [data_dir, test_dir]:
            if not os.path.exists(d):
                raise VICTestError('Directory: {0} does not exist'.format(d))

    # Print welcome information
    print(description)
    print('\nStarting tests now...Start Time: {0}\n'.format(starttime))
    print('Running Test Set: {0}'.format(', '.join(args.tests)))

    # Setup VIC executable
    if not (len(args.tests) == 1 and args.tests[0] == 'unit'):
        vic_exe = VIC(args.vic_exe)
        print('VIC version information:\n\n{0}'.format(vic_exe.version.decode()))

    # run test sets
    # unit
    if any(i in ['all', 'unit'] for i in args.tests):
        test_results['unit'] = run_unit_tests(test_dir)

    # system
    if any(i in ['all', 'system'] for i in args.tests):
        test_results['system'] = run_system(args.system, vic_exe, data_dir,
                                            os.path.join(out_dir, 'system'),
                                            args.driver)
    # science
    if any(i in ['all', 'science'] for i in args.tests):
        test_results['science'] = run_science(args.science, vic_exe, data_dir,
                                              os.path.join(out_dir, 'science'),