Пример #1
0
def test_profile_overlay():
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        kwds = src.profile
    kwds.update(**default_gtiff_profile())
    assert kwds['tiled']
    assert kwds['compress'] == 'lzw'
    assert kwds['count'] == 3
Пример #2
0
def test_profile_overlay():
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        kwds = src.meta
    kwds.update(**default_gtiff_profile())
    assert kwds['tiled']
    assert kwds['compress'] == 'lzw'
    assert kwds['count'] == 3
Пример #3
0
def test_update_vfs(tmpdir, mode):
    """VFS datasets can not be created or updated"""
    with pytest.raises(TypeError):
        rasterio.open(
            'zip://{0}'.format(tmpdir), mode,
            **default_gtiff_profile(
                count=1, width=1, height=1))
Пример #4
0
def test_blockysize_guard(tmpdir):
    """blockysize can't be greater than image height."""
    tiffname = str(tmpdir.join('foo.tif'))
    with pytest.raises(ValueError):
        _ = rasterio.open(
            tiffname, 'w',
            **default_gtiff_profile(count=1, width=256, height=128))
Пример #5
0
def test_open_with_profile(tmpdir):
    tiffname = str(tmpdir.join('foo.tif'))
    with rasterio.open(tiffname, 'w',
                       **default_gtiff_profile(count=1, width=1,
                                               height=1)) as dst:
        data = dst.read()
        assert data.flatten().tolist() == [0]
Пример #6
0
def test_update_vfs(tmpdir, mode):
    """VFS datasets can not be created or updated"""
    with pytest.raises(TypeError):
        _ = rasterio.open(
            'zip://{0}'.format(tmpdir), mode,
            **default_gtiff_profile(
                count=1, width=1, height=1))
Пример #7
0
def test_open_with_profile(tmpdir):
    tiffname = str(tmpdir.join('foo.tif'))
    with rasterio.open(
            tiffname,
            'w',
            **default_gtiff_profile(
                count=1, width=256, height=256)) as dst:
        data = dst.read()
Пример #8
0
def test_open_with_profile(tmpdir):
        tiffname = str(tmpdir.join('foo.tif'))
        with rasterio.open(
                tiffname,
                'w',
                **default_gtiff_profile(
                    count=1, width=1, height=1)) as dst:
            data = dst.read()
            assert data.flatten().tolist() == [0]
Пример #9
0
def test_open_with_profile(tmpdir):
    tiffname = str(tmpdir.join('foo.tif'))
    with rasterio.open(tiffname, 'w',
                       **default_gtiff_profile(count=1, width=256,
                                               height=256)) as dst:
        assert not dst.closed
Пример #10
0
def test_blockysize_guard(tmpdir):
    """blockysize can't be greater than image height."""
    tiffname = str(tmpdir.join('foo.tif'))
    with pytest.raises(ValueError):
        _ = rasterio.open(tiffname, 'w', **default_gtiff_profile(
                count=1, width=256, height=128))