Exemple #1
0
def test_scalar_slice(layer_crs_nongeom):
    scaler = WCSScaler(layer_crs_nongeom)
    scaler.slice("y", 5)
    assert scaler.dim("y") == (None, 5, 5)
    assert scaler.subsetted.y
    assert scaler.is_slice("y")
    assert scaler.dim("x") == (None, None, None)
    assert not scaler.subsetted.x
    assert not scaler.is_slice("x")
Exemple #2
0
def test_scale_size(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.to_crs("EPSG:3577")
    scaler.scale_size("x", 512)
    scaler.scale_size("y", 512)
    assert scaler.dim("x") == (512, -2407984.8524648934, 2834259.110253384)
    assert scaler.dim("y") == (512, -5195512.771063174, -936185.3115191332)
Exemple #3
0
def test_scale_axis(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.to_crs("EPSG:3577")
    scaler.scale_axis("x", 2.0)
    scaler.scale_axis("y", 0.5)
    assert scaler.dim("x") == (419380, -2407984.8524648934, 2834259.110253384)
    assert scaler.dim("y") == (85187, -5195512.771063174, -936185.3115191332)
Exemple #4
0
def test_transform_two_slices(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.slice("x", 120.0)
    scaler.slice("y", -20.0)
    scaler.to_crs("EPSG:3577")
    assert scaler.dim("x") == (1, -1248178.532656371, -1248153.532656371)
    assert scaler.dim("y") == (1, -2202762.0236987285, -2202787.0236987285)
Exemple #5
0
def test_transform_slice_trim(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.trim("x", 120.0, 130.0)
    scaler.slice("y", -20.0)
    scaler.to_crs("EPSG:3577")
    assert scaler.dim("x") == (None, -1248178.532656371, -208327.4583571618)
    assert scaler.dim("y") == (None, -2202762.0236987285, -2145729.370620175)
Exemple #6
0
def test_transform_two_trims(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.trim("x", 120.0, 130.0)
    scaler.trim("y", -30.0, -20.0)
    scaler.to_crs("EPSG:3577")
    assert scaler.dim("x") == (None, -1248178.532656371, -190806.89815343948)
    assert scaler.dim("y") == (None, -3317050.4161210703, -2145729.370620175)
Exemple #7
0
def test_transform_one_slice(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.slice("x", 120.0)
    scaler.to_crs("EPSG:3577")
    assert scaler.crs == "EPSG:3577"
    assert scaler.dim("y") == (None, -5195512.771063174, -936185.3115191332)
    assert scaler.dim("x") == (None, -1361473.6681777071, -980861.0939271128)
Exemple #8
0
def test_scale_extent(layer_crs_geom):
    # N.B. We don't really understand what scale_extent is supposed to do.
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.to_crs("EPSG:3577")
    scaler.scale_extent("x", 150, 450)
    scaler.scale_extent("y", 0, 300)
    assert scaler.dim("x") == (300, -2407984.8524648934, 2834259.110253384)
    assert scaler.dim("y") == (300, -5195512.771063174, -936185.3115191332)
Exemple #9
0
def test_transform_one_trim(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.trim("x", 120.0, 130.0)
    scaler.to_crs("EPSG:3577")
    assert scaler.dim("x") == (None, -1361473.6681777071, -163710.79405154017)
    assert scaler.dim("y") == (None, -5195512.771063174, -936185.3115191332)
Exemple #10
0
def test_transform_unsubsetted(layer_crs_geom):
    scaler = WCSScaler(layer_crs_geom, "EPSG:4326")
    scaler.to_crs("EPSG:3577")
    assert scaler.crs == "EPSG:3577"
    assert scaler.dim("x") == (None, -2407984.8524648934, 2834259.110253384)
    assert scaler.dim("y") == (None, -5195512.771063174, -936185.3115191332)