SatAgro / suntime

Simple sunset and sunrise time calculation python library.
GNU Lesser General Public License v3.0
108 stars 38 forks source link

Feature request: report whether we have midnight sun or polar night #32

Open rfjakob opened 2 months ago

rfjakob commented 2 months ago

In the polar regions, the sun may stay up the whole day (midnight sun) or may stay down the whole day (polar night). In both cases, we raise the same exception: https://github.com/SatAgro/suntime/blob/8053379488a6fb941ece1db30988bb0f89bfd606/suntime/suntime.py#L36

It would be useful to know whether we have sunlight the whole day or night the whole day.

Looking at https://github.com/SatAgro/suntime/blob/8053379488a6fb941ece1db30988bb0f89bfd606/suntime/suntime.py#L104-L107 it seems that the algorithm knows whether we have midnight sun or polar night.

Could you raise a different exception depending on whether we have midnight sun or polar night?

If you agree that this is a useful feature I can try to make a PR.

bendeaton commented 2 weeks ago

+1 this request, came here looking for this. My use case is computing hours of daylight at a location, so a more specific exception would help me distinguish 0 vs 24 hours.