Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a shoreline vector with a single point in create_complete_line_string #271

Closed
2320sharon opened this issue Jul 10, 2024 · 0 comments

Comments

@2320sharon
Copy link
Collaborator

This error occurs because only a single shoreline was discovered for a given date which means it cannot be saved as a linestring. Instead save it as a shapely.Point.

Bug reported by @mlundine

Saved extracted shorelines to /home/aksup/doodleverse/CoastSeg/sessions/ID_krt21_datetime04-04-24__11_42_37_RGB
Computing transect shoreline intersections: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1319/1319 [05:06<00:00,  4.30it/s]Traceback (most recent call last):
  File "/home/aksup/doodleverse/CoastSeg/alaska_zoo_test.py", line 110, in <module>
    zoo_model_instance.extract_shorelines_with_unet(settings=settings,
  File "/home/aksup/doodleverse/CoastSeg/src/coastseg/zoo_model.py", line 932, in extract_shorelines_with_unet
    common.save_transects(
  File "/home/aksup/doodleverse/CoastSeg/src/coastseg/common.py", line 1927, in save_transects
    merged_timeseries_df,timeseries_df = add_lat_lon_to_timeseries(merged_timeseries_df, transects_gdf.to_crs('epsg:4326'),cross_distance_df,
  File "/home/aksup/doodleverse/CoastSeg/src/coastseg/common.py", line 1801, in add_lat_lon_to_timeseries
    new_gdf_shorelines_wgs84=convert_points_to_linestrings(cross_shore_pts, group_col='date', output_crs='epsg:4326')
  File "/home/aksup/doodleverse/CoastSeg/src/coastseg/common.py", line 2026, in convert_points_to_linestrings
    linestrings_gdf = order_linestrings_gdf(linestrings_gdf,linestrings_gdf['date'],output_crs=output_crs)
  File "/home/aksup/doodleverse/CoastSeg/src/coastseg/common.py", line 1681, in order_linestrings_gdf
    line_string = create_complete_line_string(points)
  File "/home/aksup/doodleverse/CoastSeg/src/coastseg/common.py", line 1656, in create_complete_line_string
    return LineString(sorted_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
2320sharon added a commit that referenced this issue Jul 10, 2024
@github-project-automation github-project-automation bot moved this to Done in CoastSeg Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant