Differences between revisions 11 and 12
Revision 11 as of 2009-06-09 17:30:45
Size: 1389
Editor: CarlNobile
Comment:
Revision 12 as of 2009-06-09 18:38:08
Size: 1393
Editor: CarlNobile
Comment:
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
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]]. 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]].

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

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.

isNight = ss.isNight()

The formula was taked 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)