Commit 2d8da58c authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Improved tests.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent b25a3362
Pipeline #5633 passed with stages
in 6 minutes and 22 seconds
......@@ -103,6 +103,9 @@ class Test_SensorMapGeometryTransformer(TestCase):
self.assertTrue(False not in np.isclose(np.array([xmin, ymin, xmax, ymax]),
np.array(self.expected_dem_area_extent_lonlat)))
self.assertFalse(np.array_equal(np.unique(dem_map_geo), np.array([0])))
self.assertTrue(np.isclose(np.mean(dem_map_geo[dem_map_geo != 0]),
np.mean(self.dem_sensor_geo),
rtol=0.01))
with self.assertRaises(ValueError):
SMGT.to_map_geometry(self.dem_sensor_geo[:10, :10], tgt_prj=4326) # must have the shape of lons/lats
......@@ -123,6 +126,9 @@ class Test_SensorMapGeometryTransformer(TestCase):
self.assertTrue(False not in np.isclose(np.array([xmin, ymin, xmax, ymax]),
np.array(self.expected_dem_area_extent_utm)))
self.assertFalse(np.array_equal(np.unique(dem_map_geo), np.array([0])))
self.assertTrue(np.isclose(np.mean(dem_map_geo[dem_map_geo != 0]),
np.mean(self.dem_sensor_geo),
rtol=0.01))
class Test_SensorMapGeometryTransformer3D(TestCase):
......@@ -165,6 +171,8 @@ class Test_SensorMapGeometryTransformer3D(TestCase):
self.assertIsInstance(data_mapgeo_3D, np.ndarray)
# only validate number of bands (height and width are validated in 2D version
# fixed numbers may fail here due to float uncertainty errors
self.assertGreater(data_mapgeo_3D.shape[0], self.data_sensor_geo_3D.shape[0])
self.assertGreater(data_mapgeo_3D.shape[1], self.data_sensor_geo_3D.shape[1])
self.assertEquals(data_mapgeo_3D.shape[2], 2)
xmin, xmax, ymin, ymax = corner_coord_to_minmax(get_corner_coordinates(gt=dem_gt,
cols=data_mapgeo_3D.shape[1],
......@@ -172,6 +180,10 @@ class Test_SensorMapGeometryTransformer3D(TestCase):
self.assertTrue(False not in np.isclose(np.array([xmin, ymin, xmax, ymax]),
np.array(self.expected_dem_area_extent_lonlat)))
self.assertTrue(np.isclose(np.mean(data_mapgeo_3D[data_mapgeo_3D != 0]),
np.mean(self.data_sensor_geo_3D),
rtol=0.01))
def test_to_sensor_geometry(self):
for rsp_alg in rsp_algs:
SMGT = SensorMapGeometryTransformer3D(lons=self.lons_3D,
......
Markdown is supported
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