Skip to content

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

@rfjakob

Description

@rfjakob

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:

raise SunTimeException('The sun never rises on this location (on the specified date)')

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

Looking at

suntime/suntime/suntime.py

Lines 104 to 107 in 8053379

if cosH > 1:
return None # The sun never rises on this location (on the specified date)
if cosH < -1:
return None # The sun never sets on this location (on the specified date)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions