File: test_image_structure.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 (74 lines) | stat: -rw-r--r-- 1,937 bytes parent folder | download | duplicates (6)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import rasterio

from rasterio.enums import Compression, Interleaving


def test_enum_compression_JPEG():
    assert Compression('JPEG').name == 'jpeg'


def test_enum_compression_LZW():
    assert Compression('LZW').name == 'lzw'


def test_enum_compression_PACKBITS():
    assert Compression('PACKBITS').name == 'packbits'


def test_enum_compression_DEFLATE():
    assert Compression('DEFLATE').name == 'deflate'


def test_enum_compression_CCITTRLE():
    assert Compression('CCITTRLE').name == 'ccittrle'


def test_enum_compression_CCITTFAX3():
    assert Compression('CCITTFAX3').name == 'ccittfax3'


def test_enum_compression_CCITTFAX4():
    assert Compression('CCITTFAX4').name == 'ccittfax4'


def test_enum_compression_LZMA():
    assert Compression('LZMA').name == 'lzma'


def test_enum_compression_NONE():
    assert Compression('NONE').name == 'none'


def test_compression_none():
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        assert src.compression is None
        assert 'compress' not in src.profile


def test_compression_deflate():
    with rasterio.open('tests/data/rgb_deflate.tif') as src:
        assert src.compression.name == 'deflate'
        assert src.compression.value == 'DEFLATE'
        assert src.profile['compress'] == 'deflate'


def test_enum_interleaving_BAND():
    assert Interleaving('BAND').name == 'band'


def test_enum_interleaving_PIXEL():
    assert Interleaving('PIXEL').name == 'pixel'


def test_interleaving_pixel():
    with rasterio.open('tests/data/RGB.byte.tif') as src:
        assert src.interleaving.name == 'pixel'
        assert src.interleaving.value == 'PIXEL'
        assert src.profile['interleave'] == 'pixel'


def test_interleaving_band():
    with rasterio.open('tests/data/rgb_deflate.tif') as src:
        assert src.interleaving.name == 'band'
        assert src.interleaving.value == 'BAND'
        assert src.profile['interleave'] == 'band'