Ejemplo n.º 1
0
def test_complex_reg_av(test_params):
    calc = Calc(intvl_out='ann',
                dtype_out_time='reg.av',
                region=[sahel],
                **test_params)
    calc.compute()
    _test_files_and_attrs(calc, 'reg.av')
Ejemplo n.º 2
0
def test_simple_reg_ts(test_params):
    calc = Calc(intvl_out='ann',
                dtype_out_time='reg.ts',
                region=[globe],
                **test_params)
    calc.compute()
    _test_files_and_attrs(calc, 'reg.ts')
Ejemplo n.º 3
0
 def test_monthly_ts(self):
     calc_int = CalcInterface(intvl_out=1,
                              dtype_out_time='ts',
                              **self.test_params)
     calc = Calc(calc_int)
     calc.compute()
     assert isfile(calc.path_out['ts'])
     assert isfile(calc.path_tar_out)
Ejemplo n.º 4
0
 def test_seasonal_mean(self):
     calc_int = CalcInterface(intvl_out='djf',
                              dtype_out_time='av',
                              **self.test_params)
     calc = Calc(calc_int)
     calc.compute()
     assert isfile(calc.path_out['av'])
     assert isfile(calc.path_tar_out)
Ejemplo n.º 5
0
 def test_simple_reg_av(self):
     calc_int = CalcInterface(intvl_out='ann',
                              dtype_out_time='reg.av',
                              region=[globe],
                              **self.test_params)
     calc = Calc(calc_int)
     calc.compute()
     assert isfile(calc.path_out['reg.av'])
     assert isfile(calc.path_tar_out)
Ejemplo n.º 6
0
def test_compute_pressure_thicknesses():
    calc = Calc(intvl_out='ann',
                dtype_out_time='av',
                var=dp,
                proj=example_proj,
                model=example_model,
                run=example_run,
                date_range=('0006', '0006'),
                intvl_in='monthly',
                dtype_in_time='ts',
                dtype_in_vert='sigma',
                dtype_out_vert=None)
    calc.compute()
    _test_files_and_attrs(calc, 'av')
    _clean_test_direcs()
Ejemplo n.º 7
0
def test_recursive_calculation(recursive_test_params):
    basic_params, recursive_params = recursive_test_params

    calc = Calc(intvl_out='ann', dtype_out_time='av', **basic_params)
    calc = calc.compute()
    expected = xr.open_dataset(calc.path_out['av'])['condensation_rain']
    _test_files_and_attrs(calc, 'av')

    calc = Calc(intvl_out='ann', dtype_out_time='av', **recursive_params)
    calc = calc.compute()
    result = xr.open_dataset(
        calc.path_out['av'])['recursive_condensation_rain']
    _test_files_and_attrs(calc, 'av')

    xr.testing.assert_equal(expected, result)
Ejemplo n.º 8
0
def test_recursive_calculation(recursive_test_params):
    basic_params, recursive_params = recursive_test_params

    calc = Calc(intvl_out='ann', dtype_out_time='av', **basic_params)
    calc = calc.compute()
    with xr.set_options(enable_cftimeindex=True):
        expected = xr.open_dataset(calc.path_out['av'],
                                   autoclose=True)['condensation_rain']
    _test_files_and_attrs(calc, 'av')

    calc = Calc(intvl_out='ann', dtype_out_time='av', **recursive_params)
    calc = calc.compute()
    with xr.set_options(enable_cftimeindex=True):
        result = xr.open_dataset(calc.path_out['av'],
                                 autoclose=True)['recursive_condensation_rain']
    _test_files_and_attrs(calc, 'av')

    xr.testing.assert_equal(expected, result)
Ejemplo n.º 9
0
def test_monthly_ts(test_params):
    calc = Calc(intvl_out=1, dtype_out_time='ts', **test_params)
    calc.compute()
    _test_files_and_attrs(calc, 'ts')
Ejemplo n.º 10
0
def test_seasonal_ts(test_params):
    calc = Calc(intvl_out='djf', dtype_out_time='ts', **test_params)
    calc.compute()
    _test_files_and_attrs(calc, 'ts')
Ejemplo n.º 11
0
def test_annual_mean(test_params):
    calc = Calc(intvl_out='ann', dtype_out_time='av', **test_params)
    calc.compute()
    _test_files_and_attrs(calc, 'av')