예제 #1
0
                       filt=['id', 'east', 'north', 'elev'])
 w = rd_st.Load()
 st_coord = [x for x in w if x['id'] == cr.json['station_id']]
 if not st_coord:
     logging.fatal("Station not found: %s", cr.json['station_id'])
     sys.exit(-1)
 # coordinate writer
 fmt = '.%df' % cr.json['decimals']
 if re.search('^http[s]?://', cr.json['coo_wr']):
     wrt = HttpWriter(url=cr.json['coo_wr'], mode='POST', dist=fmt)
 elif re.search('^sqlite:', cr.json['coo_wr']):
     wrt = SqLiteWriter(db=cr.json['coo_wr'][7:], dist=fmt,
                        table='monitoring_coo',
                        filt=['id', 'east', 'north', 'elev', 'datetime'])
 else:
     wrt = GeoWriter(fname=cr.json['coo_wr'], mode='a', dist=fmt)
 # observation writer
 if re.search('^http[s]?://', cr.json['obs_wr']):
     wrt1 = HttpWriter(url=cr.json['obs_wr'], mode='POST', dist=fmt)
 elif re.search('^sqlite:', cr.json['obs_wr']):
     wrt1 = SqLiteWriter(db=cr.json['obs_wr'][7:], dist=fmt,
                         table='monitoring_obs',
                         filt=['id', 'hz', 'v', 'distance',
                               'crossincline', 'lengthincline', 'datetime'])
 else:
     wrt1 = GeoWriter(fname=cr.json['obs_wr'], mode='a', dist=fmt)
 # information writer
 if 'inf_wr' in cr.json:
     if re.search('^http[s]?://', cr.json['inf_wr']):
         wrt2 = HttpWriter(url=cr.json['inf_wr'], mode='POST', dist=fmt)
     elif re.search('^sqlite:', cr.json['inf_wr']):
예제 #2
0
         ofname2 = ofname[:-4] + '.csv'
     else:
         ofname1 = ofname2 = ofname
     dmp_wrt = CsvWriter(angle = 'DMS', dist = '.4f', \
         filt = ['station', 'id','hz','v','distance', 'datetime'], \
         fname = ofname1, mode = 'a', sep = ';')
     coo_wrt = CsvWriter(dist = '.4f', \
         filt = ['id', 'east', 'north', 'elev', 'datetime'], \
         fname = ofname2, mode = 'a', sep = ';')
 elif ofname[-4:] == '.geo' or ofname[-4:] == '.coo':
     # geo/coo file output
     if ofname[-4:] == '.geo' or ofname[-4:] == '.coo':
         ofname1 = ofname[:-4] + '.geo'
         ofname2 = ofname[:-4] + '.coo'
     dmp_wrt = GeoWriter(angle = 'RAD', dist = '.4f', \
         filt = ['station', 'ih', 'id', 'th', 'hz', 'v', 'distance', \
         'datetime'], fname = ofname1, mode = 'a')
     coo_wrt = GeoWriter(dist = '.4f', \
         filt = ['id', 'east', 'north', 'elev', 'datetime'], \
         fname = ofname2, mode = 'a')
 elif ofname[:5] == 'http:' or ofname[:6] == 'https:':
     # http output
     ofname1 = ofname2 = ofname
     dmp_wrt = HttpWriter(angle = 'RAD', dist = '.4f', \
         filt = ['station', 'id','hz','v','distance', 'datetime'], \
         url = ofname1, mode = 'POST')
     coo_wrt = HttpWriter(angle = 'RAD', dist = '.4f', \
         filt = ['id', 'east', 'north', 'elev', 'datetime'], \
         url = ofname2, mode = 'POST')
 # totalstation
 if re.search('120[0-9]$', stationtype):
예제 #3
0
        from leicatca1800 import LeicaTCA1800
        mu = LeicaTCA1800()
    elif re.search('550[0-9]$', stationtype):
        from trimble5500 import Trimble5500
        mu = Trimble5500()
    else:
        print("unsupported instrument type")
        exit(1)
    if len(sys.argv) > 3:
        port = sys.argv[3]
    else:
        port = 'COM1'

    iface = SerialIface("rs-232", port)
    if otype == 'geo':
        geo_wrt = GeoWriter(dist='.4f', angle='RAD', fname=ofname+'.geo', mode='w')
        coo_wrt = GeoWriter(dist='.4f', angle='RAD', fname=ofname + '.coo', mode='w')
    else:
        geo_wrt = CsvWriter(dist='.4f', fname=ofname+'.dmp', \
            header=True, filt=['station', 'id', 'hz', 'v', 'faces'])
        coo_wrt = CsvWriter(dist='.4f', fname=ofname+'.csv', \
            header=True, filt=['id', 'east', 'north', 'elev'])
    ts = TotalStation(stationtype, mu, iface)

    # get station data
    coo = {}
    coo['id'] = raw_input("Station id: ")
    coo['east'] = float(raw_input("Station  east: "))
    coo['north'] = float(raw_input("Station north: "))
    coo['elev'] = float(raw_input("Station  elev: "))
    coo_wrt.WriteData(coo)
예제 #4
0
    station_id = None
    if len(sys.argv) > 3:
        station_id = sys.argv[3]
    station_ih = 0
    if len(sys.argv) > 4:
        station_ih = float(sys.argv[4])

    # load input data set
    if ifname[-4:] == '.coo':
        g = GeoReader(fname=ifname, filt=['id', 'east', 'north', 'elev'])
    else:
        g = CsvReader(fname=ifname, filt=['id', 'east', 'north', 'elev'])
    data = g.Load()
    if ofname[-4:] == '.geo':
        geo_wrt = GeoWriter(dist = '.4f', angle = 'RAD', fname = ofname, \
            filt = ['station', 'id', 'hz', 'v', 'distance', 'faces', 'ih', \
                    'code'], mode = 'w')
    else:
        geo_wrt = CsvWriter(dist = '.4f', angle = 'RAD', fname = ofname, \
            header = True, mode = 'w', \
            filt = ['station', 'id', 'hz', 'v', 'distance', 'faces', 'ih', \
                    'code'])
    og = ObsGen(data, station_id, station_ih)
    if og.station_east is None or og.station_north is None or og.station_elev is None:
        print "station coordinates not found: ", station_id
        exit(-1)
    observations = og.run()

    for obs in observations:
        # heck for dmp output
        if ofname[-4:] != '.geo':