log = XML_LogReader(xmlfile, site) except IOError as e: #file not found, try FTP download from usual archives sys.stderr.write( "Site `" + site + "' not in local database; trying remote retrieval ...\n") util.get_site_log(site=site) log = XML_LogReader(xmlfile, site) except Exception as e: #I guess we're doomed! sys.stderr.write("\nSomething went wrong ... \n\n") sys.stderr.write("%s\n\n" % e) sys.stderr.write(" ... better try again.\n") sys.exit(2) print "Updating site `" + site + "' (" + log.site_name() + ")" ###---------------------- #+#Connect to GIPSY sta_info database ###---------------------- sta_info = sif.sta_info_interface() sta_info.connect() #Update STA ID TABLE if not sta_info.got_sta_id(log.site()): sta_info.add_sta_id(log.site(), log.site_number(), log.site_full_name()) # sta_info.dump_sta_id() #Update SVEC TABLE sta_info.update_svec(log.site(), log.antennas())
print " %.4s %.4d %.2d %.2d %.2d %.2d %5.2f %10.2f %15.4f %14.4f %14.4f %15.7E %14.7E %14.7E %.30s" % \ ( log.site().upper(), log.year(), log.month(), log.day(), log.hour(), log.minute(), log.second(), log.duration(), log.XPos(), log.YPos(), log.ZPos(), log.XVel(), log.YVel(), log.ZVel(), log.comment() ) #print site_id format, if asked for if gipsy_sta_id: #some of these may not exist and hence return None station_name = [ log.site_name(), log.loc_city(), log.loc_state(), log.loc_country() ] station_name = [s for s in station_name if s is not None] print " %.4s %6d %.60s" % \ ( log.site().upper(), log.sta_number(), ", ".join(station_name) ) #print site vector and antenna type for all entries if gipsy_svec:
if gipsy_pos: print " %.4s %.4d %.2d %.2d %.2d %.2d %5.2f %10.2f %15.4f %14.4f %14.4f %15.7E %14.7E %14.7E %.30s" % \ ( log.site().upper(), log.year(), log.month(), log.day(), log.hour(), log.minute(), log.second(), log.duration(), log.XPos(), log.YPos(), log.ZPos(), log.XVel(), log.YVel(), log.ZVel(), log.comment() ) #print site_id format, if asked for if gipsy_sta_id: #some of these may not exist and hence return None station_name = [log.site_name(), log.loc_city(), log.loc_state(), log.loc_country()] station_name = [s for s in station_name if s is not None] print " %.4s %6d %.60s" % \ ( log.site().upper(), log.sta_number(), ", ".join(station_name) ) #print site vector and antenna type for all entries if gipsy_svec: #get all antenna records antennas = log.antennas() svec_string = []
###---------------------- try: log = XML_LogReader(xmlfile, site) except IOError as e: #file not found, try FTP download from usual archives sys.stderr.write("Site `"+site+"' not in local database; trying remote retrieval ...\n") util.get_site_log(site=site) log = XML_LogReader(xmlfile, site) except Exception as e: #I guess we're doomed! sys.stderr.write("\nSomething went wrong ... \n\n") sys.stderr.write("%s\n\n" % e) sys.stderr.write(" ... better try again.\n") sys.exit(2) print "Updating site `"+site+"' ("+log.site_name()+")" ###---------------------- #+#Connect to GIPSY sta_info database ###---------------------- sta_info = sif.sta_info_interface() sta_info.connect() #Update STA ID TABLE if not sta_info.got_sta_id(log.site()): sta_info.add_sta_id(log.site(), log.site_number(), log.site_full_name()) # sta_info.dump_sta_id() #Update SVEC TABLE sta_info.update_svec(log.site(), log.antennas())