diff --git a/MAC/Deployment/data/Coordinates/add_transformation.py b/MAC/Deployment/data/Coordinates/add_transformation.py index 68fc2537bbc76f79a59bf5d61b79e638dd05f215..aa9b414777cdb7a38a76fc9fb95f77e27d12903e 100755 --- a/MAC/Deployment/data/Coordinates/add_transformation.py +++ b/MAC/Deployment/data/Coordinates/add_transformation.py @@ -31,3 +31,4 @@ if __name__ == '__main__': Ry = getInputWithDefault("Ry (0.001'')",0.0) Rz = getInputWithDefault("Rz (0.001'')",0.0) +# ... to be continued diff --git a/MAC/Deployment/data/Coordinates/create_CDB_objects.py b/MAC/Deployment/data/Coordinates/create_CDB_objects.py index 51525b3514599a722fa87dcfdcdf812237c0f704..c6ba71b0f2961722e22012a01e5a731b7eca39aa 100755 --- a/MAC/Deployment/data/Coordinates/create_CDB_objects.py +++ b/MAC/Deployment/data/Coordinates/create_CDB_objects.py @@ -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 diff --git a/MAC/Deployment/data/Coordinates/load_measurementfile.py b/MAC/Deployment/data/Coordinates/load_measurementfile.py index 56a04e84cab22c88bd11c5255c7cc81c82e348c6..0d58408a69b96c4620178b4fdf4a4ef197329e3f 100755 --- a/MAC/Deployment/data/Coordinates/load_measurementfile.py +++ b/MAC/Deployment/data/Coordinates/load_measurementfile.py @@ -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 # diff --git a/MAC/Deployment/data/Coordinates/make_antenna_list.py b/MAC/Deployment/data/Coordinates/make_antenna_list.py new file mode 100755 index 0000000000000000000000000000000000000000..4f4d72ffac2812c1052c5fdb141ec3850bcd0167 --- /dev/null +++ b/MAC/Deployment/data/Coordinates/make_antenna_list.py @@ -0,0 +1,54 @@ +#!/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) +