Astral – Python Sun Calculations.
Astral is a Python module designed to calculate the following times of the day...
- Dawn
- Sunrise
- Solar Noon
- Sunset
- Dusk
- Ruhakaalam
Plus solar azimuth and elevation, at a particular time...
for any latitude and longitude.
The following example shows how the module can be used.
from astral import Astral city-name = 'London' astral = Astral() astral.solar-depression = 'civil' city = astral[city-name] print('Information for %s/%s\n' % (city-name, city.country)) tz-name = city.tz-name print('Timezone: %s' % tz-name) print('Latitude: %.02f; Longitude: %.02f\n' % (city.latitude, city.longitude)) sun = city.sun(local=True) print('Dawn: %s' % str(sun['dawn'])) print('Sunrise: %s' % str(sun['sunrise'])) print('Noon: %s' % str(sun['noon'])) print('Sunset: %s' % str(sun['sunset'])) print('Dusk: %s' % str(sun['dusk']))
Which produces the following output:
Information for London/England Timezone: Europe/London Latitude: 51.60; Longitude: 0.08 Dawn: 2009-04-22 05:12:56+01:00 Sunrise: 2009-04-22 05:49:36+01:00 Noon: 2009-04-22 12:58:48+01:00 Sunset: 2009-04-22 20:09:07+01:00 Dusk: 2009-04-22 20:45:52+01:00
Dependencies
Astral is dependent on the following Python libraries
Download
| Version | Description | URL |
|---|---|---|
| 0.7 |
|
astral-0.7.zip |
| 0.6.2 |
|
astral-0.6.2.zip |
| 0.6.1 |
|
astral-0.6.1.zip |
| 0.6 | astral-0.6.zip | |
| 0.5 |
|
astral-0.5.zip |
| 0.4 |
|
astral-0.4.zip |
| 0.3 |
|
astral-0.3.zip |
| 0.2 | Fix for bug #554041 (MIT license.) | astral-0.2.zip |
| 0.1 | Initial version (MIT license.) | astral-0.1.zip |
Source Code
The source code for the Astral package can be browsed here http://bazaar.launchpad.net/~sffjunkie/astral/trunk/files
You can download the latest version of the source using Bazaar (bzr)
bzr checkout lp:astral
Bug Reports
Please use the Astral project page on Launchpad.net to submit bug reports.