def test_get_nodata_pos(self): dem = Grid(infolder + "/small25.tif") arr = dem._array row, col = dem.get_nodata_pos() crow, ccol = np.where(arr == -9999) self.assertEqual( (np.array_equal(row, crow), np.array_equal(col, ccol)), (True, True))
def test_set_data_00(self): arr = np.arange(9).reshape((3, 3)) arr[[1, 2], [2, 1]] = 8 dem = Grid() dem.set_nodata(8) dem.set_array(arr) row, col = dem.get_nodata_pos() computed = dem.get_value(row, col) expected = np.array([8, 8, 8]) self.assertEqual(np.array_equal(computed, expected), True)