from simutil import simutil
pdbi = {'long': '05:54:28.5',
'a': 'w27 e04 E24 E68 N29 N46',
'b': 'W27 W12 E12 E23 N20 N46',
'c': 'W12 W09 E04 E10 N11 N17',
'd': 'W08 W05 E03 N02 N07 N11'}
Given a d:m:s string, return it as a float in degrees.
d, m, s = map(float, dms.split(':'))
def astro_stations2simdata(aststatfn):
Reads aststatfn and writes it to simdata compatible antennalists
pdbi-a.cfg, pdbi-b.cfg, pdbi-c.cfg, and pdbi-d.cfg.
aststatfn: gildas-src-mmmxxx/packages/astro/etc/astro_stations.dat
1st line is ignored: 800 / Largest baseline length
ITRF relative to PdBI center (m)
simdatfn: simdata compatible configuration file, in ITRF.
pdbi['itrf'] = mysim.locxyz2itrf(dms2d(pdbi['lat']), dms2d(pdbi['long']),
asf = open(aststatfn, 'r')
stn, xstr, ystr, zstr = line.strip().split()
statdict[stn] = [float(c) + d for (c, d) in zip((xstr, ystr, zstr), pdbi['itrf'])]
for cfg in ('a', 'b', 'c', 'd'):
stns = [s.upper() for s in pdbi[cfg].split()]
ofile = open('pdbi-' + cfg + '.cfg', 'w')
ofile.write('# observatory=IRAM_PDB\n')
ofile.write('# coordsys=XYZ\n')
ofile.write('# Plateau de Bure %s configuration,\n' % cfg.upper())
ofile.write('# converted to simdata format from\n# %s\n# (%s)\n'
% (aststatfn, time.strftime("%Y-%m-%d",
time.localtime(os.path.getmtime(aststatfn)))))
ofile.write('# by recipes.astro_stations2simdata\n')
ofile.write('# X Y Z Diam Station\n')
ofile.write('% 14.12g % 14.12g % 14.12g %4.1f %s\n' %