-
Notifications
You must be signed in to change notification settings - Fork 1
/
ephem_notes.txt
36 lines (26 loc) · 1.12 KB
/
ephem_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install ephem
import ephem
#Make an observer
fred = ephem.Observer()
#PyEphem takes and returns only UTC times. 15:00 is noon in Fredericton
#fred.date = "2013-09-04 15:00:00"
fred.date = date
#Location of Fredericton, Canada
fred.lon = str(-66.666667) #Note that lon should be in string format
fred.lat = str(45.95) #Note that lat should be in string format
#Elevation of Fredericton, Canada, in metres
fred.elev = 20
#To get U.S. Naval Astronomical Almanac values, use these settings
fred.pressure= 0
fred.horizon = '-0:34'
sunrise=fred.previous_rising(ephem.Sun()) #Sunrise
noon =fred.next_transit (ephem.Sun(), start=sunrise) #Solar noon
sunset =fred.next_setting (ephem.Sun()) #Sunset
#We relocate the horizon to get twilight times
fred.horizon = '-6' #-6=civil twilight, -12=nautical, -18=astronomical
beg_twilight=fred.previous_rising(ephem.Sun(), use_center=True) #Begin civil twilight
end_twilight=fred.next_setting (ephem.Sun(), use_center=True) #End civil twilight
print "sunrise: " + str(sunrise)
print "sunset: " + str(sunset)