File: test_vrt.py

package info (click to toggle)
rasterio 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,732 kB
  • sloc: python: 23,119; sh: 947; makefile: 275; xml: 29
file content (34 lines) | stat: -rw-r--r-- 1,227 bytes parent folder | download | duplicates (2)
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
"""Tests of the rasterio.vrt module"""

import rasterio
import rasterio.vrt


def test_boundless_vrt(path_rgb_byte_tif):
    with rasterio.open(path_rgb_byte_tif) as rgb:
        doc = rasterio.vrt._boundless_vrt_doc(rgb)
        assert doc.startswith('<VRTDataset')
        with rasterio.open(doc) as vrt:
            assert rgb.count == vrt.count
            assert rgb.dtypes == vrt.dtypes
            assert rgb.mask_flag_enums == vrt.mask_flag_enums


def test_boundless_msk_vrt(path_rgb_msk_byte_tif):
    with rasterio.open(path_rgb_msk_byte_tif) as msk:
        doc = rasterio.vrt._boundless_vrt_doc(msk)
        assert doc.startswith('<VRTDataset')
        with rasterio.open(doc) as vrt:
            assert msk.count == vrt.count
            assert msk.dtypes == vrt.dtypes
            assert msk.mask_flag_enums == vrt.mask_flag_enums


def test_boundless_vrt_fill_value(path_rgb_msk_byte_tif):
    with rasterio.open(path_rgb_msk_byte_tif) as rgb:
        doc = rasterio.vrt._boundless_vrt_doc(rgb, nodata=0)
        assert doc.startswith('<VRTDataset')
        with rasterio.open(doc) as vrt:
            assert vrt.nodata == 0
            assert rgb.count == vrt.count
            assert rgb.dtypes == vrt.dtypes