本文整理汇总了Python中util.decToDeg函数的典型用法代码示例。如果您正苦于以下问题:Python decToDeg函数的具体用法?Python decToDeg怎么用?Python decToDeg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decToDeg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getDateSecond
def getDateSecond(self, tim, place, newmoonorig):
h, m, s = util.decToDeg(tim.time)
y, mo, d = tim.year, tim.month, tim.day
y, mo, d, h, m = util.addMins(y, mo, d, h, m, 1)
tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)
while True:
h, m, s = util.decToDeg(tim.time)
y, mo, d = tim.year, tim.month, tim.day
y, mo, d, h, m, s = util.subtractSecs(y, mo, d, h, m, s, 1)
if y == 0:
y = 1
tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)
return True, tim, True
tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)
sun = planets.Planet(tim.jd, astrology.SE_SUN, self.flags)
moon = planets.Planet(tim.jd, astrology.SE_MOON, self.flags)
lonsun = sun.data[planets.Planet.LONG]
lonmoon = moon.data[planets.Planet.LONG]
d, m, s = util.decToDeg(lonsun)
lonsun = d+m/60.0+s/3600.0
d, m, s = util.decToDeg(lonmoon)
lonmoon = d+m/60.0+s/3600.0
diff = lonmoon-lonsun
newmoon, ready = self.isNewMoon(diff)
if newmoon != newmoonorig or ready:
return True, tim, ready
return False, tim
示例2: load
def load(self, li):
idx = 1
for it in li:
dirtxt = u'E'
lon = it[geonames.Geonames.LON]
if lon < 0.0:
dirtxt = u'W'
lon *= -1
d, m, s = util.decToDeg(lon)
lontxt = str(d).zfill(2)+dirtxt+str(m).zfill(2)
dirtxt = u'N'
lat = it[geonames.Geonames.LAT]
if lat < 0.0:
dirtxt = u'S'
lat *= -1
d, m, s = util.decToDeg(lat)
lattxt = str(d).zfill(2)+dirtxt+str(m).zfill(2)
gmtoffs = it[geonames.Geonames.GMTOFFS]
signtxt = u'+'
if gmtoffs < 0.0:
signtxt = u'-'
gmtoffs *= -1
frac = int((gmtoffs-int(gmtoffs))*60.0)
gmtoffstxt = signtxt+str(int(gmtoffs))+u':'+str(frac).zfill(2)
self.placedata[idx] = (it[geonames.Geonames.NAME], it[geonames.Geonames.COUNTRYNAME], lontxt, lattxt, gmtoffstxt, str(it[geonames.Geonames.ALTITUDE]))
idx += 1
示例3: printMidPoints
def printMidPoints(self, mids):
pls = ('Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'AscNode', 'DescNode')
for x in mids:
d,m,s = util.decToDeg(x.m)
dl,ml,sl = util.decToDeg(x.lat)
print "%s-%s: %d %d'%d\" %d %d'%d\"" % (pls[x.p1], pls[x.p2], d,m,s, dl, ml, sl)
示例4: drawline
def drawline(self, draw, x, y, clr, idx):
#bottom horizontal line
draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)
#vertical lines
offs = (0, self.SMALL_CELL_WIDTH, self.BIG_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)
OFFS = 2
BOR = commonwnd.CommonWnd.BORDER
summa = 0
txtclr = (0,0,0)
if not self.bw:
txtclr = self.options.clrtexts
for i in range(self.COLUMN_NUM+OFFS):#+1 is the leftmost column
draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)
d, m, s = 0, 0, 0
if i >= fixstars.FixStars.LON+OFFS:
d,m,s = util.decToDeg(self.chart.fixstars.data[idx][i-OFFS])
if i == 1:
txt = str(idx+1)+'.'
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
elif i == fixstars.FixStars.NAME+OFFS or i == fixstars.FixStars.NOMNAME+OFFS:
txt = self.chart.fixstars.data[idx][i-OFFS]
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
elif i == fixstars.FixStars.LON+OFFS:
if self.options.ayanamsha != 0:
lona = self.chart.fixstars.data[idx][i-OFFS]-self.chart.ayanamsha
lona = util.normalize(lona)
d,m,s = util.decToDeg(lona)
sign = d/chart.Chart.SIGN_DEG
pos = d%chart.Chart.SIGN_DEG
wsp,hsp = draw.textsize(' ', self.fntText)
txtsign = self.signs[sign]
wsg,hsg = draw.textsize(txtsign, self.fntMorinus)
txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
w,h = draw.textsize(txt, self.fntText)
offset = (offs[i]-(w+wsp+wsg))/2
draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-h)/2), txtsign, fill=txtclr, font=self.fntMorinus)
elif i == fixstars.FixStars.LAT+OFFS or i == fixstars.FixStars.DECL+OFFS:
sign = ''
if self.chart.fixstars.data[idx][i-2] < 0.0:
sign = '-'
txt = sign+(str(d)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
elif i == fixstars.FixStars.RA+OFFS:
txt = str(d)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
if self.options.intime:
d,m,s = util.decToDeg( self.chart.fixstars.data[idx][i-2]/15.0)
txt = (str(d)).rjust(2)+':'+(str(m)).zfill(2)+":"+(str(s)).zfill(2)
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
summa += offs[i]
示例5: fillFields
def fillFields(self, it):
self.birthplace.SetValue(it[geonames.Geonames.NAME])
#lon
east = True
lon = it[geonames.Geonames.LON]
if lon < 0.0:
east = False
lon *= -1
d, m, s = util.decToDeg(lon)
self.londeg.SetValue(str(d))
self.lonmin.SetValue(str(m))
if east:
self.placerbE.SetValue(True)
else:
self.placerbW.SetValue(True)
#lat
north = True
lat = it[geonames.Geonames.LAT]
if lat < 0.0:
north = False
lat *= -1
d, m, s = util.decToDeg(lat)
self.latdeg.SetValue(str(d))
self.latmin.SetValue(str(m))
if north:
self.placerbN.SetValue(True)
else:
self.placerbS.SetValue(True)
#zone
plus = True
gmtoffs = it[geonames.Geonames.GMTOFFS]
if gmtoffs < 0.0:
plus = False
gmtoffs *= -1
gmtoffshour = int(gmtoffs)
gmtoffsmin = int((gmtoffs-gmtoffshour)*60.0)
self.zhour.SetValue(str(gmtoffshour))
self.zminute.SetValue(str(gmtoffsmin))
val = 0
if not plus:
val = 1
self.pluscb.SetStringSelection(PlacesDlg.PLUSCHOICES[val])
#altitude
alt = int(it[geonames.Geonames.ALTITUDE])
if alt < 0:
alt = 0
self.alt.SetValue(str(alt))
示例6: drawlinelof
def drawlinelof(self, draw, x, y, name, data, clr, idx):
#bottom horizontal line
draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH_ARABIAN, y+self.LINE_HEIGHT), fill=clr)
#vertical lines
offs = (0, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)
BOR = commonwnd.CommonWnd.BORDER
summa = 0
txtclr = (0,0,0)
if not self.bw:
txtclr = self.options.clrtexts
for i in range(self.COLUMN_NUM_ARABIAN+1+1):#+1 is the leftmost column
draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)
d, m, s = 0, 0, 0
if i > 1:
d,m,s = util.decToDeg(data[i-2])
if i == 1:
w,h = draw.textsize(name, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), name, fill=txtclr, font=self.fntText)
elif i == 2:
if self.options.ayanamsha != 0:
lona = data[i-2]-self.chart.ayanamsha
lona = util.normalize(lona)
d,m,s = util.decToDeg(lona)
sign = d/chart.Chart.SIGN_DEG
pos = d%chart.Chart.SIGN_DEG
wsp,hsp = draw.textsize(' ', self.fntText)
txtsign = self.signs[sign]
wsg,hsg = draw.textsize(txtsign, self.fntMorinus)
txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
w,h = draw.textsize(txt, self.fntText)
offset = (offs[i]-(w+wsp+wsg))/2
draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-h)/2), txtsign, fill=txtclr, font=self.fntMorinus)
elif i == 3 or i == 5:
sign = ''
if data[i-2] < 0.0:
sign = '-'
txt = sign+(str(d)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
elif i == 4:
txt = str(d)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
if self.options.intime:
d,m,s = util.decToDeg(data[i-2]/15.0)
txt = (str(d)).rjust(2)+':'+(str(m)).zfill(2)+":"+(str(s)).zfill(2)
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
summa += offs[i]
示例7: drawline
def drawline(self, draw, x, y, clr, idx):
#bottom horizontal line
draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)
#vertical lines
offs = (0, self.SMALL_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)
BOR = commonwnd.CommonWnd.BORDER
summa = 0
for i in range(self.COLUMN_NUM+1+1):#+1 is the leftmost column
draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)
tclr = (0, 0, 0)
if not self.bw:
if self.options.useplanetcolors:
tclr = self.options.clrindividual[idx]
else:
dign = self.chart.dignity(idx)
tclr = self.clrs[dign]
if i == 1:
txt = common.common.Planets[idx]
w,h = draw.textsize(txt, self.fntMorinus)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntMorinus)
elif i != 0:
h,m,s = util.decToDeg(self.chart.riseset.times[idx][i-2])
txt = (str(h)).zfill(2)+':'+(str(m)).zfill(2)+':'+(str(s)).zfill(2)
w,h = draw.textsize(txt, self.fntText)
draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntText)
summa += offs[i]
示例8: drawAscMCPos
def drawAscMCPos(self): # Not used
(cx, cy) = self.center.Get()
clrpos = self.options.clrpositions
if self.bw:
clrpos = (0, 0, 0)
for i in range(2):
lon = self.chart.houses.ascmc[i]
if self.options.ayanamsha != 0:
lon -= self.chartRadix.ayanamsha
lon = util.normalize(lon)
(d, m, s) = util.decToDeg(lon)
d = d % chart.Chart.SIGN_DEG
# d, m = util.roundDeg(d%chart.Chart.SIGN_DEG, m, s)
wdeg, hdeg = self.draw.textsize(str(d), self.fntText)
wmin, hmin = self.draw.textsize((str(m).zfill(2)), self.fntSmallText)
x = (
cx
+ math.cos(
math.pi + math.radians(self.chart.houses.ascmc[houses.Houses.ASC] - self.chart.houses.ascmc[i])
)
* self.rPosAscMC
)
y = (
cy
+ math.sin(
math.pi + math.radians(self.chart.houses.ascmc[houses.Houses.ASC] - self.chart.houses.ascmc[i])
)
* self.rPosAscMC
)
xdeg = x - wdeg / 2
ydeg = y - hdeg / 2
self.draw.text((xdeg, ydeg), str(d), fill=clrpos, font=self.fntText)
self.draw.text((xdeg + wdeg, ydeg), (str(m)).zfill(2), fill=clrpos, font=self.fntSmallText)
示例9: show
def show(self, y, m, d, t, cnt):
proftype = chart.Chart.YEAR
if self.zodprofs:
prof = profections.Profections(self.chart, y, m, d, t, cnt)
pchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PROFECTION, '', self.options, False, proftype)
pchart.calcProfPos(prof)
else:
if not self.usezodprojs and (y+cnt == self.chart.time.year or (y+cnt-self.chart.time.year) % 12 == 0) and m == self.chart.time.month and d == self.chart.time.day:
pchart = self.chart
else:
prof = munprofections.MunProfections(self.chart, y, m, d, t, cnt)
proflondeg, proflonmin, proflonsec = util.decToDeg(prof.lonZ)
profplace = chart.Place(mtexts.txts['Profections'], proflondeg, proflonmin, proflonsec, prof.east, self.chart.place.deglat, self.chart.place.minlat, self.chart.place.seclat, self.chart.place.north, self.chart.place.altitude)
pchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, profplace, chart.Chart.PROFECTION, '', self.options, False, proftype, self.options.usezodprojsprof)
pchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PROFECTION, '', self.options, False, proftype, self.options.usezodprojsprof)
#modify planets, ...
pchart.planets.calcMundaneProfPos(pchart.houses.ascmc2, pchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0])
#modify lof
pchart.fortune.calcMundaneProfPos(pchart.houses.ascmc2, pchartpls.fortune, self.chart.place.lat, self.chart.obl[0])
#recalc AspMatrix
pchart.calcAspMatrix()
self.parent.change(pchart, self.caption, y+cnt, m, d, t)
self.yeartxt.SetValue(str(y+cnt))
self.monthtxt.SetValue(str(m))
if self.zodprofs or self.usezodprojs:
self.daytxt.SetValue(str(d))
示例10: OnAdd
def OnAdd(self, fnd):
datstr = str(fnd[0])+'.'+str(fnd[1])+'.'+str(fnd[2])
h, m, s = util.decToDeg(fnd[3])
timstr = str(h).zfill(2)+':'+str(m).zfill(2)+':'+str(s).zfill(2)
item = [datstr, timstr]
self.li.OnAdd(item)
示例11: createRevolution
def createRevolution(self, year, month, trans, num = 0):
self.t[0] = year
self.t[1] = month
self.t[2] = trans.transits[num].day
h, m, s = util.decToDeg(trans.transits[num].time)
self.t[3] = h
self.t[4] = m
self.t[5] = s
示例12: createTransit
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
示例13: printRiseSet
def printRiseSet(self, pls):
numangles = len(RiseSet.Angles)
txt = [mtexts.txtsriseset['Rise'], mtexts.txtsriseset['MC'], mtexts.txtsriseset['Set'], mtexts.txtsriseset['IC']]
print ''
print 'Rise/Set times:'
for i in range(planets.Planets.PLANETS_NUM):#Nodes are excluded
for angle in range(numangles):
h,m,s = util.decToDeg(self.times[i][angle])
print "%s: %s: %02d:%02d:%02d" % (pls.planets[i].name, txt[angle], h, m, s)
示例14: onDecrDay
def onDecrDay(self, event):
h, mi, s = util.decToDeg(self.t)
yt, mt, dt = util.decrDay(self.y+self.cnt, self.m, self.d)
tim = chart.Time(yt, mt, dt, h, mi, s, self.chart.time.bc, self.chart.time.cal, self.chart.time.zt, self.chart.time.plus, self.chart.time.zh, self.chart.time.zm, self.chart.time.daylightsaving, self.chart.place, False)
if tim.jd > self.chart.time.jd:
y, self.m, self.d = util.decrDay(self.y+self.cnt, self.m, self.d)
if y != self.y+self.cnt:
self.cnt -=1
self.show(self.y, self.m, self.d, self.t, self.cnt)
示例15: read
def read(self):
res = True
try:
f = open(self.fname, 'r')
lines = f.readlines()
f.close()
#Count non-comment lines
cnt = 0
for ln in lines:
if ln[0] == FixStars.COMMENT and ln.find('example') != -1:
break
if ln[0] != FixStars.COMMENT:
cnt += 1
for i in range(1, cnt+1):
ret, name, dat, serr = astrology.swe_fixstar_ut(str(i), self.jd, 0)
d, m, s = util.decToDeg(dat[0])
sign = d/chart.Chart.SIGN_DEG
lon = d%chart.Chart.SIGN_DEG
lontxt = str(lon)+FixStars.signtxts[sign]+' '+(str(m)).zfill(2)+"' "+(str(s)).zfill(2)+'"'
d, m, s = util.decToDeg(dat[1])
si = ''
if dat[1] < 0.0:
si = '-'
lattxt = si+str(d)+' '+(str(m)).zfill(2)+"' "+(str(s)).zfill(2)+'"'
nam = name[0].strip()
nomnam = ''
DELIMITER = ','
if nam.find(DELIMITER) != -1:
snam = nam.split(DELIMITER)
nam = snam[0].strip()
nomnam = snam[1].strip()
self.data.append(FixStars.FixStar(nam, nomnam, lontxt, lattxt))
except IOError:
res = False
pass
return res