You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Threshold Selector gives an error due to division by zero. I see that the “totalArea” in the code is the issue (line 185). Can this be fixed by creating an if-statement which set the totalEnergy to sum(shadeNetFinal) if totalArea is 0?
From the code:
` #Calculate the total area and the energy saved by the new mesh.
if _inputMesh.Faces.Count == len(_analysisResult):
totalArea = sum(areaList)
totalEnergyList = []
for count, area in enumerate(areaList):
totalEnergyList.append(shadeNetFinal[count]*area)
totalEnergy = sum(totalEnergyList)
else:
totalArea = rc.Geometry.AreaMassProperties.Compute(newMesh).Area
totalEnergy = (sum(shadeNetFinal)/len(shadeNetFinal))*totalArea
Hello,
I posted on the Ladybug Forum:
https://discourse.ladybug.tools/t/threshold-divide-by-zero/10048
The Threshold Selector gives an error due to division by zero. I see that the “totalArea” in the code is the issue (line 185). Can this be fixed by creating an if-statement which set the totalEnergy to sum(shadeNetFinal) if totalArea is 0?
From the code:
` #Calculate the total area and the energy saved by the new mesh.
if _inputMesh.Faces.Count == len(_analysisResult):
totalArea = sum(areaList)
totalEnergyList = []
for count, area in enumerate(areaList):
totalEnergyList.append(shadeNetFinal[count]*area)
totalEnergy = sum(totalEnergyList)
else:
totalArea = rc.Geometry.AreaMassProperties.Compute(newMesh).Area
totalEnergy = (sum(shadeNetFinal)/len(shadeNetFinal))*totalArea
return totalEnergy, totalArea, newMesh, joinedCrv`
Best regards
The text was updated successfully, but these errors were encountered: