Skip to content
Snippets Groups Projects
Commit 48b7605c authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1236: Added script for generating an antennafile for the online software.

Cleanup of some other scripts.
parent 401aa996
No related branches found
No related tags found
No related merge requests found
......@@ -31,3 +31,4 @@ if __name__ == '__main__':
Ry = getInputWithDefault("Ry (0.001'')",0.0)
Rz = getInputWithDefault("Rz (0.001'')",0.0)
# ... to be continued
......@@ -9,9 +9,9 @@ def findStationInfo(stationName):
Return all basic station info (eg. nr RSPboards) from a station.
"""
pattern=re.compile("^"+stationName+"[ \t].*", re.IGNORECASE | re.MULTILINE)
match = pattern.search(open("../StaticMetaData/StationInfo").read())
match = pattern.search(open("../StaticMetaData/StationInfo.dat").read())
if not match:
raise "\nFatal error: "+stationName+" is not defined in file 'StationInfo'"
raise "\nFatal error: "+stationName+" is not defined in file 'StationInfo.dat'"
return match.group().split()
#
......@@ -22,7 +22,7 @@ def getStationList():
Returns a list containing all stationnames
"""
pattern=re.compile("^[A-Z]{2}[0-9]{3}[ \t].*", re.IGNORECASE | re.MULTILINE)
return [ station.split()[0] for station in pattern.findall(open("../StaticMetaData/StationInfo").read())]
return [ station.split()[0] for station in pattern.findall(open("../StaticMetaData/StationInfo.dat").read())]
#
# MAIN
......@@ -38,3 +38,4 @@ if __name__ == '__main__':
for hba in xrange(0, int(nrHBA)):
db.query("select * from add_object('%s', '%s', %d)" % ( name, "HBA", hba ))
# ... to be continued
......@@ -2,19 +2,6 @@
#coding: iso-8859-15
import re,sys,pgdb,pg
#
# findStationInfo(stationName)
#
def findStationInfo(stationName):
"""
Return all basic station info (eg. nr RSPboards) from a station.
"""
pattern=re.compile("^"+stationName+"[ \t].*", re.IGNORECASE | re.MULTILINE)
match = pattern.search(open("../StaticMetaData/StationInfo").read())
if not match:
raise "\nFatal error: "+stationName+" is not defined in file 'StationInfo'"
return match.group().split()
#
# getHeaderLines
#
......
#!/usr/bin/env python
#coding: iso-8859-15
import re,sys,pgdb
from copy import deepcopy
from math import *
INTRO="""
Created a file containing all antenna coordinates for the online software.
"""
def print_help():
print "Usage: make_antenna_list [<stationname>]"
#
# findStationInfo(stationName)
#
def findStationInfo(stationName):
"""
Return all basic station info (eg. nr RSPboards) from a station.
"""
pattern=re.compile("^"+stationName+"[ \t].*", re.IGNORECASE | re.MULTILINE)
match = pattern.search(open("../StaticMetaData/StationInfo.dat").read())
if not match:
raise "\nFatal error: "+stationName+" is not defined in file 'StationInfo.dat'"
return match.group().split()
#
# MAIN
#
if __name__ == '__main__':
if len(sys.argv) != 2:
print_help()
sys.exit(0)
(name, stationID, stnType, long, lat, height, nrRSP, nrTBB, nrLBA, nrHBA, HBAsplit, LBAcal ) = findStationInfo(sys.argv[1])
db = pgdb.connect(user="postgres", host="dop50", database="coordtest")
print "#Stn ID Type RSP RCU Pol Position Orientation"
print "%s %s %s %d %d x [%s,%s,%s] [0,0,0]" % (name, stationID, "center", -1, -1, long, lat, height)
for infoType in [ 'marker', 'lba', 'hba' ]:
cursor = db.cursor()
cursor.execute("select * from get_ref_objects(%s, %s)", (sys.argv[1], infoType))
counter = 0
while (1):
record = cursor.fetchone()
if record == None:
break
RSPnr = int(record[2]%100/4)
print "%s %s %s %d %d x [%s,%s,%s] [0,0,0]" % (name, stationID, infoType, RSPnr, counter, record[3], record[4], record[5])
print "%s %s %s %d %d y [%s,%s,%s] [0,0,0]" % (name, stationID, infoType, RSPnr, counter+1, record[3], record[4], record[5])
counter = counter + 2
db.close()
sys.exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment