Geometry: Fix division by 0 for incline.

setup.py
Pierre-Antoine Rouby 2024-01-24 15:00:31 +01:00
parent 473aac4500
commit d0afd0ed74
1 changed files with 12 additions and 8 deletions

View File

@ -25,7 +25,7 @@ from copy import deepcopy
from operator import itemgetter from operator import itemgetter
from functools import reduce from functools import reduce
from tools import flatten, timer, trace from tools import flatten, timer, trace, logger_exception
from Model.Tools.PamhyrDB import SQLSubModel from Model.Tools.PamhyrDB import SQLSubModel
@ -691,6 +691,7 @@ class Reach(SQLSubModel):
logger.debug(f"+{incline_acc}") logger.debug(f"+{incline_acc}")
logger.debug(f"-{incline_set}") logger.debug(f"-{incline_set}")
try:
return ( return (
reduce( reduce(
lambda acc, x: acc + x, lambda acc, x: acc + x,
@ -698,3 +699,6 @@ class Reach(SQLSubModel):
0.0 0.0
) / (len(incline_set)) ) / (len(incline_set))
) )
except Exception as e:
logger_exception(e)
return 0