martinc / daylight Goto Github PK
View Code? Open in Web Editor NEWA swift package that provides NOAA astronomical algorithms for sunrise and sunset times
License: MIT License
A swift package that provides NOAA astronomical algorithms for sunrise and sunset times
License: MIT License
I stumbled across this looking for a map overlay for MapKit to show daylight/night over map of the world. I am glad to see a solid foundation in this project.
Here's an enhancement I'd like to see:
Given a longitude and latitude, at the current time, is that location in daylight or darkness.
[User could choose what they consider daylight from the SolarEvent enum. It would be great if we did not have to worry about time zone and just a location on earth at the current time.]
So maybe something like:
let currentLocation = CLLocationCoordinate2D(latitude: 40.642, longitude: -74.017)
let inDaylight: Bool = currentLocation.inDaylight(usingDawn: .civilDawn, andDusk: .civilDusk)
I'll be playing around with what you have. Beats starting from NASA's codeI've seen since this is already migrated to Swift.
Locations inside polar ring, will have polar days (sun never sets) and polar nights (sun never rises).
private func hourAngleOfSunrise(latitude: Float64, solarDeclination: Float64, solarElevation: Float64) throws -> Float64
This function return NAN
when sun never rises or sun never sets.
I have made a work around to solve this problem by throw an error from there (and re-throw it along the method chain). I don't have a better solution to handle this situation, so I hope you can look into it.
The workaround I've made was in commit eca031c.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.