Differences between revisions 7 and 22 (spanning 15 versions)
Revision 7 as of 2009-06-09 16:00:30
Size: 1299
Editor: CarlNobile
Comment:
Revision 22 as of 2015-08-17 01:55:30
Size: 1876
Editor: CarlNobile
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
This class will determine the sunrise and sunset. It can use either '''official''', '''civil''', '''nautical''', '''amateur''', or '''astronomical''' zenith.
Line 3: Line 4:
This class will determine the sunrise and sunset. It can use either '''official''', '''civil''', '''nautical''', '''amateur''', or '''astronomical''' zenith. [[attachment:sunrisesunset.py]]

[[http://tetrasys.homelinux.org/cgi-bin/viewvc.cgi/sunrisesunset/?root=cvs|CVS Repository]] This is off site.

[[http:/wiki-htdocs/external/SunriseSunset/api/index.html|API Docs]]

[[http://tetrasys-design.net/download/SunriseSunset/sunrisesunset-1.0.1.tar.gz|Download Tarball]]

[[http://freshmeat.net/projects/sunrise-sunset|Freshmeat Page]]
Line 10: Line 19:
Line 18: Line 26:

The {{{isNight()}}} method returns {{{True}}} if it is nighttime and {{{False}}} if it is daytime.
The {{{isNight()}}} method returns {{{True}}} if it is nighttime and {{{False}}} if it is daytime. The optional {{{collar}}} keyword argument if changed will skew the results to either before or after the real sunrise and sunset. This is useful if lead and lag times are needed around the actual sunrise and sunset.
Line 22: Line 29:
isNight = ss.isNight() isNight = ss.isNight(collar=0)
Line 24: Line 31:
The formula was taken from a VBScript implementation which is broken for certain times of the day. It can be found at:
Line 25: Line 33:
[[attachment:sunrisesunset.py]]

The formula was taked from a VBScript implementation which is broken for certain times of the day. It can be found at [[http://4guysfromrolla.com/webtech/010800-1.shtml|4 Guys From Rolla]].
[[http://4guysfromrolla.com/webtech/010800-1.shtml|4 Guys From Rolla]]
Line 32: Line 38:
Line 33: Line 40:

Sunrise Sunset

This class will determine the sunrise and sunset. It can use either official, civil, nautical, amateur, or astronomical zenith.

sunrisesunset.py

CVS Repository This is off site.

API Docs

Download Tarball

Freshmeat Page

The constructor takes three positional arguments and one keyword argument. The date argument is a datetime object with timezone info, lat and lon are floating point values, and zenith is a string consisting of any of the above bold values--the default is official.

ss = SunriseSunset(date, lat, lon, zenith='official')

There are two callable methods after the class is instantiated.

The getSunRiseSet() method returns a tuple of datetime objects with timezome info.

rise, set = ss.getSunRiseSet()

The isNight() method returns True if it is nighttime and False if it is daytime. The optional collar keyword argument if changed will skew the results to either before or after the real sunrise and sunset. This is useful if lead and lag times are needed around the actual sunrise and sunset.

isNight = ss.isNight(collar=0)

The formula was taken from a VBScript implementation which is broken for certain times of the day. It can be found at:

4 Guys From Rolla

I also found valuable information on these sites:

http://stjarnhimlen.se/english.html

http://aa.usno.navy.mil/faq/docs/RST_defs.php

http://herbert.gandraxa.com/herbert/lod.asp

SunriseSunset (last edited 2015-08-17 01:55:30 by CarlNobile)