SunPath error with solar time and a time step of every min

Hallo Dear Ladybug Community,

I have a question about the SunPath component.
I noticed when the SolarTime option is active, I cannot analyze with a 60 minute time step (sun for every minute), at most with a 2 minute time step. But work without the AnalysPeriod component.


This error come out: math domain Error

am I doing something wrong?

Best Regards

This is very strange, the error is only with the 21 March, works with the other days and months
I attach the file, for those wishing to consult it quickly
CheckSunPathSolarTime.gh (473.5 KB)

Thanks for narrowing this down. Looking into it.

1 Like

I narrowed it a bit more. At resolution 45 it still works. 46 doesn’t.
-A.

1 Like

Hi @Sonny.Weaver,

I think error is because a math approximation with python and gh. There is a formula like this: math.acos((A) / (B) inside sunpath. I image something like this is running in your case at some point: math.acos(1.00000001).
If you modify formula with math.acos( round(A,5) / round(B,5) ) it works.

Best,
Antonello

Grazie Antonello,
I don’t have the knowledge to change the code. I’ll wait in case you find the solution.
Thanks for your time.

Kind regards

@AntonelloDiNunzio was right on spot.
The error is happenning in the LB_LB component at line 1565. It looks like this:
self.solAz = ((math.acos(((math.sin(self.solLat)*math.cos(self.zenith))
If you change it to this (like Antonello suggested) it works fine:
self.solAz = ((math.acos(((math.sin( round(self.solLat, 5)) * math.cos(round(self.zenith, 5)))
Attached the file. @Sonny.Weaver, please report at github so @mostapha, @chris, or someone else can make the change in the code. Otherwise is not much use to the whole community.
-A.
CheckSunPathSolarTime_AY.gh (488.8 KB)

1 Like

Many thanks Abraham,

I have never opened a report on github. I have to create a new post here
https://github.com/ladybug-tools/ladybug-legacy/issues?

Greetings

Yes. This is the place to report bugs or ask for wishlists.
-A.

1 Like

Thank you for reporting the issue, @Sonny.Weaver . And thank you @AntonelloDiNunzio , for identifying it as a floating point tolerance issue and @AbrahamYezioro for the fix. And sorry for being so late to this issue. I just added Abraham’s fix to the code base:

Thank you all!

1 Like