-
Notifications
You must be signed in to change notification settings - Fork 12
fix: use first line from shapely and add all dip/thickness estimates #246
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -380,10 +380,8 @@ def compute( | |||||
| for _, row in basal_contact.iterrows(): | ||||||
| # find the shortest line between the basal contact points and top contact points | ||||||
| short_line = shapely.shortest_line(row.geometry, top_contact_geometry) | ||||||
| _lines.append(short_line[0]) | ||||||
|
|
||||||
| # check if the short line is | ||||||
| if self.max_line_length is not None and short_line.length > self.max_line_length: | ||||||
| if self.max_line_length is not None and short_line[0].length > self.max_line_length: | ||||||
| continue | ||||||
| if self.dtm_data is not None: | ||||||
| inv_geotransform = gdal.InvGeoTransform(self.dtm_data.GetGeoTransform()) | ||||||
|
|
@@ -408,12 +406,14 @@ def compute( | |||||
| # find the indices of the points that are within 5% of the length of the shortest line | ||||||
| try: | ||||||
| # GEOS 3.10.0+ | ||||||
| indices = shapely.dwithin(short_line, interp_points, line_length * 0.25) | ||||||
| indices = shapely.dwithin(short_line[0], interp_points, line_length * 0.25) | ||||||
| except UnsupportedGEOSVersionError: | ||||||
| indices= numpy.array([shapely.distance(short_line[0],point)<= (line_length * 0.25) for point in interp_points]) | ||||||
|
||||||
| indices= numpy.array([shapely.distance(short_line[0],point)<= (line_length * 0.25) for point in interp_points]) | |
| indices = numpy.array([shapely.distance(short_line[0], point) <= (line_length * 0.25) for point in interp_points]) |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change alters the shape/semantics of the debug output (self.lines) by emitting one row per dip sample (_lines.extend(...); _dips.extend(...)). There are existing tests for InterpolatedStructure.compute, but none assert the contents/lengths of thickness_calculator.lines; please add a regression test to cover the new behavior (e.g., that len(lines) == len(lines['dip']) and multiple dip samples produce multiple line rows).
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be trailing whitespace on this blank line. Please remove the extra spaces (or delete the blank line) to avoid lint/format churn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says points are selected within 5% of the shortest-line length, but the threshold used is
line_length * 0.25(25%). Please update the comment or adjust the factor so they match.