CoordinateSharp
CoordinateSharp copied to clipboard
Circumpolar Region - No Sunrise Detected If Experiencing Shallow Transit
Describe the bug Unable to detect sunrise in circumpolar region during shallow transit at specific location/date.
To Reproduce Using N 76, E 45 on 2021-APR-24 UTC
Solar algorithms do not detect a sunrise on that day, but do detect sunset. This appears to be occurring due to the shallow Altitude of the sun in this area during the time. The Altitude hangs at the horizon during direction reversal which appears to confuse the algorithm.
DateTime | Altitude | Behavior |
---|---|---|
4/24/2021 8:00:00 PM | -0.541221407851604 | |
4/24/2021 8:10:00 PM | -0.675508320125998 | SET REGISTERS |
4/24/2021 8:20:00 PM | -0.784657051071834 | SET REGISTERS |
4/24/2021 8:30:00 PM | -0.868454753456538 | |
4/24/2021 8:40:00 PM | -0.926736834956746 | |
4/24/2021 8:50:00 PM | -0.959387557804776 | |
4/24/2021 9:00:00 PM | -0.966340432019743 | |
4/24/2021 9:10:00 PM | -0.947578444548961 | |
4/24/2021 9:20:00 PM | -0.903134113154309 | |
4/24/2021 9:30:00 PM | -0.833089364216574 | RISE NOT REGISTERING |
4/24/2021 9:40:00 PM | -0.737575236159505 | RISE NOT REGISTERING |
4/24/2021 9:50:00 PM | -0.616771421309262 | |
4/24/2021 10:00:00 PM | -0.470905600065937 |
https://www.esrl.noaa.gov/ exhibits similar behavior and reports no rise, even though the horizon altitude (-0.8333) is passed though.
Expected behavior Sunrise should technically report.
Environment (please complete the following information):
- .NET version: 3.1 Core
- CoordinateSharp version: 2.7.3.2
- Application type: Console
- Is mutlithreading being used? No
Additional context I believe the issue is related to limitations in the Meeus formula's directly, as evidenced by other services exhibiting similar behavior.
Investigation reveals no Approximate Time (Meeus Formula 15.1) returned on 25-APR-2021 at the location in UTC. Because of the lack of Approximate Time, a Rise event cannot be accurately calculated using Meeus Formula 15.2 (m2= m0 + H0/360) alone as it subtracts from the Approximate Time.
This limitation most likely effects all Solar Altitude related features, but will only be experienced in circumpolar regions on very rare occasions. It should not impact most use cases.
Iteration logic may solve this issue when detected, but efficiency needs to be considered.
INCLUDE IN: internal static DateTime?[] Get_Event_Time()
IF NO RISE OCCURS BUT SET EXISTS
{
ITERATE DAY IN 1 HOUR INCREMENTS
{
IF(ALTITUDE IS PASSED DURING ALTITUDE INCREASE) ITERATE HOUR IN 1 MINUTE INCREMENTS
{
IF(ALTITUDE IS PASSED) ITERATE MINUTE IN 1 SECOND INCREMENTS
{
RETURN DATETIME WHEN ALTITUDE PASSED OR HIT.
}
}
}
}