from taskinit import *
from getazel import *
import pylab as pl
import os
import datetime
from matplotlib.dates import DateFormatter
def plotsrcazel(planet='', srcfile='', date='', obs='ALMA', plotsun=False, plottype='', saveplot='', elimit='3.0deg'):
'''
plot Azimuth/elevation track of a source (or list of sources)
on given date. For solar system objects known to Measures(this excludes minor planets, Jovian moons, etc),
name is sufficient but for other sources
RAs and Decs are required.
(requires getazel.py)
Input:
planet - a planet (optional)
srcfile - (optional) An ascii file with source_name coordinates (J2000) seperated by
a white space. A line with '#' will be skipped.
The solar system can also be include without coodinates.
0423-013 4h23m0s -1d20m0s
#3c273 12h29m0s 2d3m0s
3c279 12h56m0s -5d47m0s
Mars
date - 'YYYY/MM/DD' if not specified it will be prompted to enter later
obs - observatory name (ALMA,EVLA,etc)
plotsun - True will plot the Sun also
plottype - Az, El, or both (if left blank it will ask to enter later)
saveplot - save to the plot to ps file with the name specified in this paramter
elimit - draw horizontal line to indicate elevation limit.
Examples:
plotsrcazel('Uranus') # enter date, plottype when prompted
plotsrcazel(planet='Uranus', date='2012/06/01', plottype='both')
plotsrcazel(planet='Uranus', srcfile='calandtarget.txt') #plot Uranus and sources defined
# in calandtarget.txt
version 2015.05.06 TT -Minor fixes to be able run on current casa
version 2012.04.20 TT
'''
inpd =""
if date=='':
inpd=raw_input('date? YYYY/MM/DD or hit return to use today\'s date:')
if inpd == "":
date=qa.time('today', form=['ymd','no_time'])[0]
else:
date=inpd
else:
date=date
print "Use date:", date
intz=raw_input('Show in UTC, CLT,or LST? ')
tz='UTC'
if intz!='':
check_intz = [intz.upper()==tl for tl in ['UTC','CLT','LST']]
if not any(check_intz):
raise Exception, "Input error: should be 'UTC','CLT',or 'LST'"
tz=intz.upper()
if srcfile!="":
if not os.path.exists(srcfile):
raise IOError, "%s does not exist!" % srcfile
readfromfile = True
else:
readfromfile = False
insrc = True
knownsrcs=['SUN', 'MOON', 'MERCURY','VENUS','MARS','JUPITER','SATURN','URANUS','NEPTUNE','PLUTO']
plotplanets=False
if planet!='':
for ksrc in knownsrcs:
if planet.upper() == ksrc:
plotplanets= True
if plottype=='':
plottype='both'
inptype=raw_input('plot type? (el, az, or both):')
if inptype=='el' or inptype=='az':