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

EmptyPartError in get_contour when chunked #133

Open
SorooshMani-NOAA opened this issue Jan 22, 2024 · 0 comments
Open

EmptyPartError in get_contour when chunked #133

SorooshMani-NOAA opened this issue Jan 22, 2024 · 0 comments
Assignees

Comments

@SorooshMani-NOAA
Copy link
Collaborator

I'm still getting the "can't create multiline string with empty component and I'm not sure why. I updated ocsmesh main branch using pip install and adding both code snippets for the hold and the matplotlib package. Here is what the error code says:

Traceback (most recent call last):
  File "/mnt/projects/hpc/mattwig/grid/ocsmesh/usace_dem.py", line 123, in <module>
    hfun_r1.add_contour(level=ref_r1+50, expansion_rate=0.05, target_size=150)
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/ocsmesh/features/constraint.py", line 403, in wrapped
    rv = method(obj, *args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/ocsmesh/hfun/raster.py", line 1022, in add_contour
    _contours = self.raster.get_contour(_level)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/ocsmesh/raster.py", line 1371, in get_contour
    return self._get_raster_contour_feathered(level, iter_windows)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/ocsmesh/raster.py", line 1497, in _get_raster_contour_feathered
    results = self._get_raster_contour_feathered_internal(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/ocsmesh/raster.py", line 1559, in _get_raster_contour_feathered_internal
    features = ops.linemerge(features)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/shapely/ops.py", line 108, in linemerge
    source = MultiLineString([ls.coords for ls in lines])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mattwig/miniconda3/envs/ocsmesh/lib/python3.11/site-packages/shapely/geometry/multilinestring.py", line 52, in __new__
    raise EmptyPartError(
shapely.errors.EmptyPartError: Can't create MultiLineString with empty component

Originally posted by @melissamattwig in #127 (reply in thread)

@SorooshMani-NOAA SorooshMani-NOAA self-assigned this Jan 22, 2024
@SorooshMani-NOAA SorooshMani-NOAA changed the title Getting contours from raster in chunks can result in EmptyPartError EmptyPartError in get_contour when chunked Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant