Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running hours_sunrise_sunset plot fails on locations where the sun doesn't set #236

Open
Tom-Kingstone opened this issue Aug 2, 2024 · 4 comments
Assignees
Labels
type:bug Error or unexpected behaviour

Comments

@Tom-Kingstone
Copy link
Contributor

Description:

When running hours_sunrise_sunset on a location where any of the sunset times cannot be retrieved, the plot fails and doesn not output anything (due to a.normalize() not working when sunset/sunrise times are null).

Steps to reproduce:

Run hours_sunrise_sunset on a location where the sun does not set (this includes twilight zones), e.g. Aberdeen.

Expected behaviour:

A plot that shows the hours sunrise sunset where in the middle, the block spans the height of the plot.

Test file(s):

using a suitable location

hours_sunrise_sunset(location=location)

Additional Comments

This also appears to affect hours_sunlight as well, but doesn't show errors and plots the following:
sun_up_hours

@Tom-Kingstone Tom-Kingstone added the type:bug Error or unexpected behaviour label Aug 2, 2024
@Tom-Kingstone
Copy link
Contributor Author

doing a bit of digging, the cause seems to stem from sunrise_sunset outputting a df where the start and end times are set to NaT
image
Likely the solution to this would be when the start and end times are NaT, fill in start time = current index date at 00:00, then end time = current index data + 1 day at 00:00

@Tom-Kingstone
Copy link
Contributor Author

Above solution has its limits - for a location within the arctic circle, there are days where there is no sun, so this case needs to be handled as well. Currently produces produces errors for hours_sunrise_sunset and plots for hours_sunlight that look like this for files within the arctic circle:
sun_up_hours

@tg359
Copy link
Contributor

tg359 commented Aug 15, 2024

This is my favourite issue. I've been waiting to see if anyone ever tries to put an EPW/Location through it from the arctic circle! When I originally coded it up I did think about handling it, but thought it would be unlikely to ever happen ... and then started thinking about whether it could be expanded to include sunrise/set time on other planets, which then led to non-24-hour time systems and how on earth (pun intended) to geo(is geo even appropriate?)-locate positions on other planets too.

I then got distracted by other stuff, but thank-you for reminding me about this one 😄

@tg359
Copy link
Contributor

tg359 commented Aug 15, 2024

Also, would there be such a thing as nautical twilight on a planet without liquid water?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants