示例#1
0
def test_welch_chained():
    input_dir = 'testsuite/data'
    exp_name = 'run_chained'

    files_generated = utils.generate_data(input_dir, exp_name, '2d_A', 'TSURF')

    files_generated.extend(
        utils.generate_data(input_dir, exp_name, '2d_B', 'T2M'))

    cmd = 'python paths_init.py -pr {} -ts'.format(input_dir)
    status, _ = utils.shell_cmd(cmd)

    assert status == 0, 'paths_init.py failed'

    cmd = 'python process_data.py -e {} -t welch --spinup 0 \
            --p_stages testsuite/stages \
            --wrkdir testsuite/workdir \
            --f_vars_to_extract vars_welchs_test.csv \
            -c'.format(exp_name)

    status, _ = utils.shell_cmd(cmd)

    assert status == 0, 'process_data.py failed'

    cmd = 'python perform_test.py  -e {} -t welch  \
            --p_stages testsuite/stages \
            --wrkdir testsuite/workdir \
            --p_ref_csv_files testsuite/ref --f_vars_to_extract \
            vars_welchs_test.csv -ts'.format(exp_name)

    status, _ = utils.shell_cmd(cmd)

    utils.delete_data(files_generated)

    assert status == 0, 'perform_test.py failed'
示例#2
0
def test_emi_embed():

    input_dir = 'testsuite/data'
    exp_name = 'run_embed'

    files_generated = utils.generate_data(input_dir, exp_name, 'emi_A', 'SO2')
    files_generated.extend(
        utils.generate_data(input_dir, exp_name, 'emi_B', 'CO2'))

    cmd = 'python paths_init.py -pr {} -ts'.format(input_dir)
    status, _ = utils.shell_cmd(cmd)

    assert status == 0, 'paths_init.py failed'

    cmd = 'python sanity_test.py -v -e {} -t emi \
            --p_ref_csv_files testsuite/ref \
            --f_vars_to_extract vars_emi_test.csv \
            --p_stages testsuite/stages \
            --wrkdir testsuite/workdir \
            --spinup 0 -c -ts'.format(exp_name)

    status, _ = utils.shell_cmd(cmd)

    utils.delete_data(files_generated)

    assert status == 0, 'sanity_test.py failed'
示例#3
0
def test_fldcor_chained():

    input_dir = 'testsuite/data'
    exp_name = 'run_chained'
    files_generated = []

    os.makedirs('testsuite/stages', exist_ok=True)

    standard_postproc = 'testsuite/stages/standard_postproc_rmse_{}.nc'\
        .format(exp_name)

    files_generated.append(standard_postproc)

    file_with_ftp_link = ('testsuite/variables_to_process/rmse'
                          '/ftp_fake_postproc.txt')

    cmd = ('wget --quiet --input-file={} '
           '--output-document={}'.format(file_with_ftp_link,
                                         standard_postproc))
    status, _ = utils.shell_cmd(cmd)

    assert status == 0, 'Could not download reference from ftp-server'

    cmd = 'python paths_init.py -pr {} -ts'.format(input_dir)
    status, _ = utils.shell_cmd(cmd)

    assert status == 0, 'paths_init.py failed'

    cmd = 'python process_data.py -v -e {} -t rmse \
        --p_stages testsuite/stages \
        --wrkdir testsuite/workdir \
        --f_vars_to_extract vars_rmse_test.csv '.format(exp_name)

    status, _ = utils.shell_cmd(cmd)

    assert status == 0, 'process_data.py failed'

    cmd = 'python perform_test.py -v -e {} -t rmse \
        --p_stages testsuite/stages \
        --wrkdir testsuite/workdir \
        --p_ref_csv_files testsuite/ref --f_vars_to_extract \
        vars_rmse_test.csv -ts'.format(exp_name)

    status, _ = utils.shell_cmd(cmd)

    utils.delete_data(files_generated)

    assert status == 0, 'perform_test.py failed'