Skip to content

Commit 6c2cbb9

Browse files
committed
add test_get_init_dem_vert_scale
1 parent 717ae3d commit 6c2cbb9

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

tests/test_ortho.py

+23-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@
3131
from rasterio.warp import transform_bounds
3232
from rasterio.windows import from_bounds
3333

34-
from orthority import common
35-
from orthority import errors, param_io
36-
from orthority.camera import Camera, create_camera, PinholeCamera
37-
from orthority.enums import CameraType, Compress, Interp, Driver
34+
from orthority import common, errors, param_io
35+
from orthority.camera import Camera, PinholeCamera, create_camera
36+
from orthority.enums import CameraType, Compress, Driver, Interp
3837
from orthority.errors import OrthorityError
3938
from orthority.ortho import Ortho
4039
from tests.conftest import _dem_resolution
@@ -224,6 +223,26 @@ def test_get_init_dem(
224223
assert test_bounds[2:] >= ref_bounds[2:]
225224

226225

226+
def test_get_init_dem_vert_scale(
227+
rgb_byte_src_file: Path,
228+
float_utm34n_egm2008_dem_file: Path,
229+
pinhole_camera: Camera,
230+
utm34n_egm2008_crs: str,
231+
rgb_pinhole_utm34n_ortho: Ortho,
232+
):
233+
"""Test that initial DEM bounds account for vertical scale / CRS by comparing bounds where the
234+
DEM and camera have the same relative geometry, but different vertical CRS.
235+
"""
236+
ortho_egm2008 = Ortho(
237+
rgb_byte_src_file, float_utm34n_egm2008_dem_file, pinhole_camera, crs=utm34n_egm2008_crs
238+
)
239+
dem_bounds_egm2008 = array_bounds(*ortho_egm2008._dem_array.shape, ortho_egm2008._dem_transform)
240+
dem_bounds_novertcrs = array_bounds(
241+
*rgb_pinhole_utm34n_ortho._dem_array.shape, rgb_pinhole_utm34n_ortho._dem_transform
242+
)
243+
assert dem_bounds_egm2008 == pytest.approx(dem_bounds_novertcrs, abs=1e-1)
244+
245+
227246
@pytest.mark.parametrize(
228247
# varying rotations starting at ``rotation`` fixture value & keeping full DEM coverage
229248
'opk_offset',

0 commit comments

Comments
 (0)