Tronald / CoordinateSharp

A library designed to ease geographic coordinate format conversions, and determine sun/moon information in C#
Other
361 stars 59 forks source link

Incorrect Sun Condition During Near Horizon Transition in Circumpolar Regions #239

Closed Tronald closed 2 months ago

Tronald commented 2 months ago

Describe the bug Horizon transition causing confusion in circumpolar region, causing CoordinateSharp to think sun is DownAllDay when it is up all day.

To Reproduce Please provide a reproducible code example if able.

Expected behavior June / July should not have DownAllDay events. These should be up all day events. Issue only occurs when time of day < 12:00

Environment (please complete the following information):

Additional context Dissect sun condition logic and determine trigger. Push emergency patch.

Tronald commented 2 months ago

Issue identified. Two simultaneous things are happening at once that need addressing.

Shallow Transit Meeus Issue. KNOWN ISSUE. Down All Day Trigger should be set to -0.8333, not 0, with a check at Solar Noon, not at user-specified altitude, for greater accuracy.

A NoSet / NoRise safety check will be added to handle part 1 and set the condition to "up or down all day" if the issue's condition is met. The math delta is significant during shallow transit (could be up to an hour), but this is the best solution for the use cases of this library (which is intended for applications prioritizing efficiency over precision). Real-world observer will, in most instances, have no concern if the output is "up or down all day" when the sun is hung near -0.8333 degrees in altitude. During shallow transition. Moreover, this issue would exhibit on rare occurrences, possibly one day a year in select circumpolar regions.

Documentation will need to be updated to ensure precision and limitation is understood.

Fix should be available in next couple days.

Tronald commented 2 months ago

UPDATE 7/7/2024 - 19:25 UTC

Fix has been implemented in code. Awaiting unit test and documentation updates prior to pushing to Nuget.

Jan32 commented 2 months ago

Picture1

Tronald commented 2 months ago

Thanks @Jan32 . I am hoping to have the fixed pushed out in the next 48 hours after we've completed some tests. I will keep you posted.

Tronald commented 2 months ago

@Jan32 Fix has been published. Please update to 2.24.1.1 via Nuget. Let me know if you see any odd behavior still.

https://www.nuget.org/packages/CoordinateSharp/2.24.1.1