|||
tablecube.pro
radec2azel.py
azel2radec.py
j2000tojnow.py
rise_set.py
=========================================================================
#radec2azel.py
import ephem
import numpy as np
import time
import sys
if (len(sys.argv)<3):
print 'too few input parameters, format:'
print 'python radec2azel ra dec'
print 'example:'
print 'python radec2azel 20.0 20.0'
sys.exit()
convert=np.pi/180.0
class coordinate:
def __init__(place):
place.name=''
place.ra=''
place.dec=''
Dawodang=coordinate()
Dawodang.name='Dawodang'
Dawodang.ra='106.856594'
Dawodang.dec='25.652939'
def ectolocal(ra,dec):
global convert
getlocal = ephem.Observer()
getlocal.long, getlocal.lat = Dawodang.ra,Dawodang.dec # at Dawodang
ct = time.gmtime()
ct3 = time.strftime("%Y/%m/%d %H:%M:%S",ct)
getlocal.date = ct3 # UT
body = ephem.FixedBody()
body._ra = ra
body._dec = dec
body._epoch = ephem.J2000
body.compute(getlocal)
x= float(body.az)*180/np.pi
y= float(body.alt)*180/np.pi
return x,y
#ra0=float(sys.argv[1])*convert
#dec0=float(sys.argv[2])*convert
ra0=ephem.degrees(ephem.hours(sys.argv[1]))
dec0=ephem.degrees(sys.argv[2])
print ra0,dec0
az,el=ectolocal(ra0,dec0)
print az,el
=========================================================================
=========================================================================
#azel2radec.py
import ephem
import numpy as np
import time
import sys
if (len(sys.argv)<3):
print 'too few input parameters, format:'
print 'python azel2radec az el'
print 'example:'
print 'python azel2radec 20.0 20.0'
sys.exit()
convert=np.pi/180.0
class coordinate:
def __init__(place):
place.name=''
place.ra=''
place.dec=''
place.alt=''
Dawodang=coordinate()
Dawodang.name='Dawodang'
Dawodang.ra='106.856594'
Dawodang.dec='25.652939'
Dawodang.alt='1138.72178'
def localtoec(az,el):
global convert
getlocal = ephem.Observer()
getlocal.long, getlocal.lat = Dawodang.ra,Dawodang.dec # at Dawodang
getlocal.pressure = 0
getlocal.epoch = ephem.J2000
ct = time.gmtime()
ct3 = time.strftime("%Y/%m/%d %H:%M:%S",ct)
getlocal.date = ct3 # UT
ra,dec = getlocal.radec_of(az,el)
return ra,dec
az0 = float(sys.argv[1])*convert
el0 = float(sys.argv[2])*convert
ra,dec=localtoec(az0,el0)
print ra,dec
#print float(ra)/convert,float(dec)/convert
print ephem.degrees(ra)/convert,ephem.degrees(dec)/convert
=========================================================================
=========================================================================
#j2000tojnow.py
import ephem
import numpy as np
import time
import sys
if(len(sys.argv)<3):
print 'too few input parameters, format:'
print 'python j2000tojnow ra dec'
print 'example:'
print 'python j2000tojnow 20.0 20.0'
sys.exit()
convert=np.pi/180.0
ra0=ephem.degrees(ephem.hours(sys.argv[1]))
dec0=ephem.degrees(sys.argv[2])
star = ephem.FixedBody()
star._ra = ra0
star._dec = dec0
star._epoch = '2000'
star.compute(epoch=ephem.now())
print star.ra,star.dec
print ephem.degrees(star.ra)/convert,ephem.degrees(star.dec)/convert
=========================================================================
=========================================================================
# rise_set.py
import ephem
import numpy as np
import time
import sys
if (len(sys.argv)<3):
print 'too few input parameters, format:'
print 'python rise_set ra dec'
print 'example:'
print 'python rise_set 20.0 20.0'
sys.exit()
convert=np.pi/180.0
Dawodang=ephem.Observer()
Dawodang.lat='25.652939'
Dawodang.lon='106.856594'
body = ephem.FixedBody()
ra0=ephem.hours(sys.argv[1])
dec0=ephem.degrees(sys.argv[2])
body._ra=ra0
body._dec=dec0
trise=Dawodang.previous_rising(body)
print 'previous rise'
print body.alt,body.az,trise
ttrans=Dawodang.next_transit(body)
print 'next transit'
print body.alt,body.az,ttrans
tset=Dawodang.next_setting(body)
print 'next setting'
print body.alt,body.az,tset
=========================================================================
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-23 02:09
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社