Example #1
0
def test_blob_filling_realdata_rgb():

    tmpdir = '/tmp/blob_filling'
    tester = TestingSetup(tmpdir)

    blobfile = os.path.join(os.getcwd(), 'tests/fixtures/blob/seams_4band.tif')
    rgb_file = os.path.join(tmpdir, '3band.tif')

    with rio.open(blobfile) as src:
        options = src.meta.copy()
        options.update(nodata=0.0,
                       count=3,
                       tiled=True,
                       blockxsize=256,
                       blockysize=256)
        with rio.open(rgb_file, 'w', **options) as dst:
            for b in range(1, 4):
                dst.write(src.read(b), b)

    filled_file = os.path.join(tmpdir, 'filliwack.tif')
    expectedfile = os.path.join(os.getcwd(),
                                'tests/expected/blob/seams_4band.tif')

    runner = CliRunner()

    result = runner.invoke(cli, [
        'blob', rgb_file, filled_file, '-m', 4, '-n', '--co', 'compress=LZW',
        '--alphafy'
    ])
    assert result.exit_code == 0

    raster_tester.compare(filled_file, expectedfile)
    tester.cleanup()
Example #2
0
def test_blob_filling_realdata():
    tmpdir = '/tmp/blob_filling'
    tester = TestingSetup(tmpdir)

    blobfile = os.path.join(os.getcwd(), 'tests/fixtures/blob/seams_4band.tif')
    filled_file = os.path.join(tmpdir, 'filliwack.tif')
    expectedfile = os.path.join(os.getcwd(),
                                'tests/expected/blob/seams_4band.tif')

    runner = CliRunner()

    result = runner.invoke(
        cli,
        ['blob', blobfile, filled_file, '-m', 4, '-n', '--co', 'compress=LZW'])
    assert result.exit_code == 0

    raster_tester.compare(filled_file, expectedfile)
    tester.cleanup()
Example #3
0
def test_blob_filling_realdata_specific_bands():
    tmpdir = '/tmp/blob_filling'
    tester = TestingSetup(tmpdir)

    blobfile = os.path.join(os.getcwd(), 'tests/fixtures/blob/seams_4band.tif')
    filled_file = os.path.join(tmpdir, 'filliwack-1-2-3.tif')
    expectedfile = os.path.join(
        os.getcwd(), 'tests/expected/blob/bands-1-2-3-filled-only.tif')

    runner = CliRunner()
    result = runner.invoke(cli, [
        'blob', blobfile, filled_file, '-m', 10, '--co', 'compress=LZW',
        '--bidx', "[1, 2, 3]"
    ])
    assert result.exit_code == 0

    raster_tester.compare(filled_file, expectedfile)
    tester.cleanup()
Example #4
0
def test_blob_filling_rgb():
    tmpdir = '/tmp/blob_filling'
    tester = TestingSetup(tmpdir)

    infile = os.path.join(os.getcwd(), 'tests/fixtures/blob/rgb_toblob.tif')
    blobbed_file = os.path.join(tmpdir, 'blobbedrgb.tif')
    expectedfile = os.path.join(os.getcwd(),
                                'tests/expected/blob/rgb_toblob.tif')

    runner = CliRunner()

    result = runner.invoke(cli, [
        'blob', infile, blobbed_file, '-m', 10, '--co', 'compress=JPEG',
        '--alphafy'
    ])
    assert result.exit_code == 0

    raster_tester.compare(blobbed_file, expectedfile)
    tester.cleanup()
Example #5
0
def compare(input_1, input_2, pixel_threshold, upsample, downsample, no_error,
            compare_masked, debug, flex_mode):
    raster_tester.compare(input_1, input_2, pixel_threshold, upsample,
                          downsample, compare_masked, no_error, debug,
                          flex_mode)