-
Notifications
You must be signed in to change notification settings - Fork 0
/
datelocsun.py
38 lines (30 loc) · 990 Bytes
/
datelocsun.py
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
37
38
import sys, types, chkdate
import Location # My module
from Location import *
# Jarmo Lammi 2015
# Solar calculator powered with Python 2.7.6
znt_official = 90.833
code = chkdate.validate(sys.argv)
if isinstance(code, types.IntType):
print "Error code: %d" % code
exit(code)
else:
year = code[0]
month = code[1]
day = code[2]
d1 = Dates(year, month, day)
dnr = d1.yday()
sd = d1.getdate()
print("\nDate %s (Day number %d) \n" % (sd, dnr))
cityTable = getTable("locationData.txt")
nr = len(cityTable) - 1 # Number of cities
for i in range(0, nr):
city, latitude, longitude, timeZone = getRowdata(cityTable[i])
pl = Location(city, latitude, longitude, timeZone)
pl.printrecord()
solpa = Solar(dnr, pl, "SUNRISE", znt_official)
solpb = Solar(dnr, pl, "SET", znt_official)
delivery(solpa, solpb, pl)
# meandecl = getdeclination(solpa, solpb)
# print("Declination %.2f degrees at noon" % meandecl)
print("-----------\n")