Skip to content

Commit

Permalink
Fixed add mask test and function
Browse files Browse the repository at this point in the history
  • Loading branch information
Mappboy committed Sep 18, 2016
1 parent 8c5a5f7 commit dd5cd4d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
7 changes: 2 additions & 5 deletions frisson/frisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ def _points_to_string(gcp_points):
assert type(gcp) in [list, tuple]
assert len(gcp) == 4
gcp_s.append(["-gcp"])
coords = []
for coord in gcp:
if type(coord) == float:
coord = str(coord)
coords.append(coord)

gcp_s[-1].append(" ".join(coords))
gcp_s[-1].append(coord)
return gcp_s


Expand All @@ -82,7 +79,7 @@ def add_mask(input_filename, output_filename, mask_vectors):
"-a_srs",
"+init=epsg:4326",
"-of",
"VRT"] + [x for y in _points_to_string2(mask_vectors) for x in y] + [
"VRT"] + [x for y in _points_to_string(mask_vectors) for x in y] + [
input_filename,
output_filename,
]
Expand Down
21 changes: 11 additions & 10 deletions tests/unit/test_frisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ class TestPrintPoint(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.gcp_points = [
[12895157.1042, -3756156.6509, 1989.1230, -2999.8393],
[12895157.1042, -3756156.6509, 1989.1230, -2999.8393],
[12898106.0028, -3756364.7068, 4083.4782, -3103.3251],
[12898161.6258, -3754995.9836, 4108.2269, -2151.3432]
]
cls.gcp_string = [
["-gcp", "12895157.1042 -3756156.6509 "
"1989.123 -2999.8393"],
["-gcp", "12898106.0028 -3756364.7068 "
"4083.4782 -3103.3251"],
["-gcp", "12898161.6258 -3754995.9836 "
"4108.2269 -2151.3432"]
["-gcp", "12895157.1042",
"-3756156.6509",
"1989.123", "-2999.8393"],
["-gcp", "12898106.0028", "-3756364.7068",
"4083.4782", "-3103.3251"],
["-gcp", "12898161.6258", "-3754995.9836",
"4108.2269", "-2151.3432"]
]

def test_input_exists(self):
self.assertTrue(path.isfile("tests/cons 1636 item 3706.tif"), "Test File doesn't exist")

Expand Down Expand Up @@ -67,9 +69,8 @@ def tearDownClass(self):
"tests/test_output.dbf",
"tests/test_output.shp",
"tests/test_output.shx"
]
]
for tf in test_files:
if path.isfile(tf):
pass
#remove(tf)

# remove(tf)

0 comments on commit dd5cd4d

Please sign in to comment.