Fix bug with ref_poly_filter where if less than 2 shoreline points remain in the shoreline extraction area after filtering out points outside of the region this error occurs.
Traceback (most recent call last):
File "/home/aksup/doodleverse/CoastSeg/3_zoo_workflow_sds_benchmark.py", line 130, in <module>
zoo_model_instance.run_model_and_extract_shorelines(
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/zoo_model.py", line 752, in run_model_and_extract_shorelines
self.extract_shorelines_with_unet(
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/zoo_model.py", line 889, in extract_shorelines_with_unet
extracted_shorelines.create_extracted_shorelines_from_session(
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/extracted_shoreline.py", line 1970, in create_extracted_shorelines_from_session
extracted_shorelines_dict = extract_shorelines_with_dask(
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/extracted_shoreline.py", line 85, in wrapper
result = func(*args, **kwargs)
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/extracted_shoreline.py", line 1389, in extract_shorelines_with_dask
satellite_dict = process_satellite(
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/extracted_shoreline.py", line 455, in process_satellite
results = dask.compute(*tasks)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/dask/base.py", line 661, in compute
results = schedule(dsk, keys, **kwargs)
File "/home/aksup/doodleverse/CoastSeg/src/coastseg/extracted_shoreline.py", line 648, in process_satellite_image
shoreline = SDS_shoreline.filter_shoreline( shoreline,shoreline_extraction_area,output_epsg)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/coastsat/SDS_shoreline.py", line 149, in filter_shoreline
filtered_shoreline_gdf = ref_poly_filter(shoreline_extraction_area_gdf, shoreline_gdf)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/coastsat/SDS_shoreline.py", line 367, in ref_poly_filter
new_line_LineString = arr_to_LineString(new_line_arr)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/coastsat/SDS_shoreline.py", line 52, in arr_to_LineString
line = shapely.geometry.LineString(points)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/shapely/geometry/linestring.py", line 73, in __new__
geom = shapely.linestrings(coordinates)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/shapely/decorators.py", line 77, in wrapped
return func(*args, **kwargs)
File "/home/aksup/miniconda3/envs/coastseg_gym/lib/python3.10/site-packages/shapely/creation.py", line 120, in linestrings
return lib.linestrings(coords, out=out, **kwargs)
shapely.errors.GEOSException: IllegalArgumentException: point array must contain 0 or >1 elements
Fix bug with
ref_poly_filter
where if less than 2 shoreline points remain in the shoreline extraction area after filtering out points outside of the region this error occurs.