Esempio n. 1
0
def test_colocator_with_obs_data_dir_ungridded():
    col = Colocator(save_coldata=False)
    col.model_id = 'TM5-met2010_CTRL-TEST'
    col.obs_id = 'AeronetSunV3L2Subset.daily'
    col.obs_vars = 'od550aer'
    col.ts_type = 'monthly'
    col.apply_time_resampling_constraints = False

    aeronet_loc = tda.ADD_PATHS['AeronetSunV3L2Subset.daily']
    col.obs_data_dir = tda.testdatadir.joinpath(aeronet_loc)

    data = col._run_gridded_ungridded()
    assert len(data) == 1
    cd = data['od550aer']
    assert isinstance(cd, ColocatedData)
    assert cd.ts_type == 'monthly'
    assert str(cd.start) == '2010-01-15T00:00:00.000000000'
    assert str(cd.stop) == '2010-12-15T00:00:00.000000000'
Esempio n. 2
0
def test_colocator_with_obs_data_dir_gridded():
    col = Colocator(save_coldata=False)
    col.model_id = 'TM5-met2010_CTRL-TEST'
    col.obs_id = 'TM5-met2010_CTRL-TEST'
    col.obs_vars = 'od550aer'
    col.ts_type = 'monthly'
    col.apply_time_resampling_constraints = False

    obs_dir = 'modeldata/TM5-met2010_CTRL-TEST/renamed'
    col.obs_data_dir = str(tda.testdatadir.joinpath(obs_dir))

    data = col._run_gridded_gridded()
    assert len(data) == 1
    cd = data['od550aer']
    assert isinstance(cd, ColocatedData)
    assert cd.ts_type == 'monthly'
    assert str(cd.start) == '2010-01-15T00:00:00.000000000'
    assert str(cd.stop) == '2010-12-15T00:00:00.000000000'
Esempio n. 3
0
def test_colocator_read_ungridded():
    col = Colocator(raise_exceptions=True)
    obs_id = 'AeronetSunV3L2Subset.daily'
    obs_var = 'od550aer'
    col.obs_filters = {'longitude': [-30, 30]}
    col.obs_id = obs_id
    col.read_opts_ungridded = {'last_file': 10}

    data = col.read_ungridded(obs_var)
    assert isinstance(data, UngriddedData)

    col.read_opts_ungridded = None
    col.obs_vars = ['od550aer']
    with does_not_raise_exception():
        data = col.read_ungridded()
    col.obs_vars = ['invalid']
    with pytest.raises(DataCoverageError):
        data = col.read_ungridded()