forked from financial-astrology-research/morinus-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuntransits.py
executable file
·57 lines (39 loc) · 955 Bytes
/
suntransits.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import astrology
import mtexts
import transits
import util
class SunTransits:
def __init__(self):
self.t = [0, 0, 0, 0, 0, 0]
def compute(self, by, bm, bd, chrt, trlon):
for i in range(13):
trans = transits.Transits()
trans.month(by, bm, chrt, astrology.SE_SUN, trlon)
if len(trans.transits) > 0:
if not (i == 0 and bd > trans.transits[0].day):
self.createTransit(by, bm, trans)
return True
by, bm = self.incrMonth(by, bm)
return False
def decrMonth(self, year, month):
if month != 1:
month -= 1
else:
month = 12
year -= 1
return year, month
def incrMonth(self, year, month):
if month != 12:
month += 1
else:
month = 1
year += 1
return year, month
def createTransit(self, year, month, trans):
self.t[0] = year
self.t[1] = month
self.t[2] = trans.transits[0].day
h, m, s = util.decToDeg(trans.transits[0].time)
self.t[3] = h
self.t[4] = m
self.t[5] = s