Add better error detection when calculating slope from profile

develop
Chris Leaman 6 years ago
parent 48f2142708
commit 95f525ef00

@ -337,10 +337,16 @@ def slope_from_profile(
] ]
if len(end_point_btm) == 0: if len(end_point_btm) == 0:
# If there doesn't seem to be an intersection seaward of the top elevation, return none. # If there doesn't seem to be an intersection seaward of the top elevation, return none.
logger.warning("No intersections found seaward of top elevation")
return None return None
else: else:
end_points[end_type]["x"] = end_point_btm[0] end_points[end_type]["x"] = end_point_btm[0]
# Ensure that top point is landward of bottom point
if end_points["top"]["x"] > end_points["btm"]["x"]:
logger.warning("Top point is not landward of bottom point")
return None
if method == "end_points": if method == "end_points":
x_top = end_points["top"]["x"] x_top = end_points["top"]["x"]
x_btm = end_points["btm"]["x"] x_btm = end_points["btm"]["x"]

Loading…
Cancel
Save