Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sliu008 committed Aug 6, 2024
1 parent e7daf4c commit bf36b63
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/test_footprint_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,26 @@ def test_lambda_handler_cumulus(mocked_get):
results = aws_s3.Object(bucket, key).load()
generated_footprint = True
assert generated_footprint


def compare_shapes(wkt1, wkt2):
"""
Compares two WKT shapes and returns True if they are identical, False otherwise.
Parameters:
wkt1 (str): Well-Known Text (WKT) representation of the first shape.
wkt2 (str): Well-Known Text (WKT) representation of the second shape.
Returns:
bool: True if the shapes are identical, False otherwise.
"""
# Convert WKT to Shapely geometries
shape1 = wkt.loads(wkt1)
shape2 = wkt.loads(wkt2)

# Check if the shapes are identical
return shape1.equals(shape2)


def test_forge_py():

Expand Down Expand Up @@ -258,4 +277,4 @@ def test_forge_py():
lat_data = ds[latitude_var]
wkt_alphashape = forge.generate_footprint(lon_data, lat_data, thinning_fac=thinning_fac, alpha=alpha, is360=is360, simplify=simplify, strategy=strategy)

assert wkt_alphashape == polygon_shape
assert compare_shapes(wkt_alphashape, polygon_shape)

0 comments on commit bf36b63

Please sign in to comment.