https://github.com/riggsd/solartime
Sunset/sunrise time calculation in Python
https://github.com/riggsd/solartime
Last synced: about 2 months ago
JSON representation
Sunset/sunrise time calculation in Python
- Host: GitHub
- URL: https://github.com/riggsd/solartime
- Owner: riggsd
- License: apache-2.0
- Created: 2015-01-20T19:41:18.000Z (over 10 years ago)
- Default Branch: dev
- Last Pushed: 2019-05-14T20:08:53.000Z (about 6 years ago)
- Last Synced: 2023-08-08T02:29:15.352Z (almost 2 years ago)
- Language: Python
- Size: 77.1 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
This is 'solartime', a Python module which calculates times for various positions of the sun:
dawn, sunrise, solar noon, sunset, and dusk.'solartime' is a vastly-simplified fork of Simon Kennedy's 'astral' module, and is Free / Libre
Open Source software under the Apache 2.0 license.Its only dependency is the `pytz` package, and Python 2.6, 2.7, 3.3+.
Example usage:
>>> from datetime import date
>>> from pytz import timezone
>>> from solartime import SolarTime
>>>
>>> today = date(2014, 4, 20)
>>> localtz = timezone('US/Eastern')
>>> lat, lon = 38.0, -79.0
>>>
>>> sun = SolarTime()
>>> schedule = sun.sun_utc(today, lat, lon)
>>> sunset = schedule['sunset'].astimezone(localtz)
>>> print sunset
2014-04-20 19:56:38-04:00License
=======Copyright 2015 David A. Riggs
Copyright 2009-2014 Simon KennedyLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.