Exemple #1
0
def test_get_common_resolution(mode, fn):
    bounds = [(-10.0, 50.0, 0.0, 60.0), (-12.0, 40.0, -2.0, 52.0),
              (-13.0, 50.0, -3.0, 60.0), (-9.0, 51.0, 1.0, 61.0)]
    datasets = [generate_test_dataset(extent=ext) for ext in bounds]
    res = np.array([get_resolution(ds) for ds in datasets])
    common_res = tuple(fn(res, axis=0))
    assert_equal(get_common_resolution(datasets, mode=mode), common_res)
Exemple #2
0
def test_get_common_resolution_different_projections():
    crs = [epsg4326, sinusoidal]
    datasets = [generate_test_dataset(crs=c) for c in crs]
    with assert_raises_regex(ValueError,
                             "All datasets must have the same projection."):
        get_common_resolution(datasets)
Exemple #3
0
def test_get_common_resolution_invalid_mode():
    datasets = [generate_test_dataset() for i in range(3)]
    with assert_raises_regex(ValueError, "Unsupported mode: 'invalid'"):
        get_common_resolution(datasets, mode='invalid')