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

Threshold Selector - divide by zero #745

Open
tobkri opened this issue Jun 12, 2020 · 0 comments
Open

Threshold Selector - divide by zero #745

tobkri opened this issue Jun 12, 2020 · 0 comments

Comments

@tobkri
Copy link

tobkri commented Jun 12, 2020

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

@tobkri tobkri changed the title Threshold divide by zero Threshold Selector - divide by zero Jun 12, 2020
@mostaphaRoudsari mostaphaRoudsari transferred this issue from ladybug-tools/ladybug Jun 12, 2020
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