File: test_meta.py

package info (click to toggle)
rasterio 1.4.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,760 kB
  • sloc: python: 22,520; makefile: 275; sh: 164; xml: 29
file content (25 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Tests of dataset meta keywords and dataset creation

import rasterio


def test_copy_meta(tmpdir):
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        kwds = src.meta
    with rasterio.open(
            str(tmpdir.join('test_copy_meta.tif')), 'w', **kwds) as dst:
        assert dst.meta['count'] == 3


def test_blacklisted_keys(tmpdir):
    # Some keys were removed from .meta when they were found to clash with
    # creation options.
    # https://github.com/rasterio/rasterio/issues/402
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        kwds = src.meta
    with rasterio.open(
            str(tmpdir.join('test_copy_meta.tif')), 'w', **kwds) as dst:
        keys = map(lambda x: x.lower(), dst.meta.keys())
        assert 'blockxsize' not in keys
        assert 'blockysize' not in keys
        assert 'tiled' not in keys