Commit 85c4e089 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Test for RuntimeWarning.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent fca86210
......@@ -31,6 +31,7 @@
import os
from unittest import TestCase
import pytest
import numpy as np
from osgeo.gdal_array import LoadFile
from py_tools_ds.geo.coord_calc import corner_coord_to_minmax, get_corner_coordinates
......@@ -76,8 +77,13 @@ class Test_SensorMapGeometryTransformer(TestCase):
lats=self.lats,
resamp_alg=rsp_alg,
radius_of_influence=30 if rsp_alg != 'bilinear' else 45)
dem_sensor_geo = SMGT.to_sensor_geometry(self.dem_map_geo,
src_prj=32632, src_extent=self.dem_area_extent_coarse_subset_utm)
kw = dict(src_prj=32632, src_extent=self.dem_area_extent_coarse_subset_utm)
if rsp_alg == 'bilinear':
with pytest.warns(RuntimeWarning, match='Bilinear resampling is not available'):
dem_sensor_geo = SMGT.to_sensor_geometry(self.dem_map_geo, **kw)
else:
dem_sensor_geo = SMGT.to_sensor_geometry(self.dem_map_geo, **kw)
self.assertIsInstance(dem_sensor_geo, np.ndarray)
self.assertFalse(np.array_equal(np.unique(dem_sensor_geo), np.array([0])))
self.assertEqual(dem_sensor_geo.shape, (150, 1000))
......@@ -273,9 +279,13 @@ class Test_SensorMapGeometryTransformer3D(TestCase):
resamp_alg=rsp_alg,
mp_alg=mp_alg
)
dem_sensors_geo = SMGT.to_sensor_geometry(self.data_map_geo_3D,
src_prj=32632,
src_extent=self.dem_area_extent_coarse_subset_utm)
kw = dict(src_prj=32632, src_extent=self.dem_area_extent_coarse_subset_utm)
if rsp_alg == 'bilinear':
with pytest.warns(RuntimeWarning, match='Bilinear resampling is not available'):
dem_sensors_geo = SMGT.to_sensor_geometry(self.data_map_geo_3D, **kw)
else:
dem_sensors_geo = SMGT.to_sensor_geometry(self.data_map_geo_3D, **kw)
self.assertIsInstance(dem_sensors_geo, np.ndarray)
self.assertEqual(dem_sensors_geo.shape, (150, 1000, 2))
self.assertEqual(self.data_map_geo_3D.dtype, dem_sensors_geo.dtype)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment