Skip to content

Commit 4e85273

Browse files
remove ducplicated methods and obsolete lines
1 parent 43a744f commit 4e85273

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

climada/hazard/centroids/test/test_centr.py

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,6 @@ def test_write_read_excel(self):
556556
def test_from_raster_file(self):
557557
"""Test from_raster_file"""
558558
width, height = 50, 60
559-
o_lat, o_lon = (10.42822096697894, -69.33714959699981)
560-
res_lat, res_lon = (-0.009000000000000341, 0.009000000000000341)
561559

562560
centr_ras = Centroids.from_raster_file(
563561
HAZ_DEMO_FL, window=Window(0, 0, width, height)
@@ -946,41 +944,6 @@ def test_union(self):
946944
cent.on_land, np.concatenate([on_land, on_land2, [None, None]])
947945
)
948946

949-
def test_select_pass(self):
950-
"""Test Centroids.select method"""
951-
region_id = np.zeros(VEC_LAT.size)
952-
region_id[[2, 4]] = 10
953-
centr = Centroids(lat=VEC_LAT, lon=VEC_LON, region_id=region_id)
954-
955-
fil_centr = centr.select(reg_id=10)
956-
self.assertEqual(fil_centr.size, 2)
957-
self.assertEqual(fil_centr.lat[0], VEC_LAT[2])
958-
self.assertEqual(fil_centr.lat[1], VEC_LAT[4])
959-
self.assertEqual(fil_centr.lon[0], VEC_LON[2])
960-
self.assertEqual(fil_centr.lon[1], VEC_LON[4])
961-
self.assertTrue(np.array_equal(fil_centr.region_id, np.ones(2) * 10))
962-
963-
def test_select_extent_pass(self):
964-
"""Test select extent"""
965-
centr = Centroids(
966-
lat=np.array([-5, -3, 0, 3, 5]),
967-
lon=np.array([-180, -175, -170, 170, 175]),
968-
region_id=np.zeros(5),
969-
)
970-
ext_centr = centr.select(extent=[-175, -170, -5, 5])
971-
np.testing.assert_array_equal(ext_centr.lon, np.array([-175, -170]))
972-
np.testing.assert_array_equal(ext_centr.lat, np.array([-3, 0]))
973-
974-
# Cross antimeridian, version 1
975-
ext_centr = centr.select(extent=[170, -175, -5, 5])
976-
np.testing.assert_array_equal(ext_centr.lon, np.array([-180, -175, 170, 175]))
977-
np.testing.assert_array_equal(ext_centr.lat, np.array([-5, -3, 3, 5]))
978-
979-
# Cross antimeridian, version 2
980-
ext_centr = centr.select(extent=[170, 185, -5, 5])
981-
np.testing.assert_array_equal(ext_centr.lon, np.array([-180, -175, 170, 175]))
982-
np.testing.assert_array_equal(ext_centr.lat, np.array([-5, -3, 3, 5]))
983-
984947
def test_get_meta(self):
985948
"""
986949
Test that the `get_meta` method correctly generates metadata
@@ -1013,7 +976,7 @@ def test_get_meta(self):
1013976
self.assertTrue(u_coord.equal_crs(meta["crs"], expected_meta["crs"]))
1014977
self.assertTrue(meta["transform"].almost_equals(expected_meta["transform"]))
1015978

1016-
def test_get_closest_point(self):
979+
def test_get_closest_point_1(self):
1017980
"""Test get_closest_point"""
1018981
for n, (lat, lon) in enumerate(LATLON):
1019982
x, y, idx = self.centr.get_closest_point(lon * 0.99, lat * 1.01)
@@ -1023,7 +986,7 @@ def test_get_closest_point(self):
1023986
self.assertEqual(self.centr.lon[n], x)
1024987
self.assertEqual(self.centr.lat[n], y)
1025988

1026-
def test_get_closest_point(self):
989+
def test_get_closest_point_2(self):
1027990
"""Test get_closest_point"""
1028991
for y_sign in [1, -1]:
1029992
meta = {

0 commit comments

Comments
 (0)