def FDSN_network(input_dics, events): """ Availability and retrieivng functions are called with FDSN_network :param input_dics: :param events: :return: """ print "\n********************************************************" print "FDSN -- Download waveforms, StationXML files and meta-data" print "********************************************************" period = "{0:s}_{1:s}".format(input_dics["min_date"].split("T")[0], input_dics["max_date"].split("T")[0]) eventpath = os.path.join(input_dics["datapath"], period) print "Initializing folders and files...", create_folders_files(events, eventpath, input_dics) print "DONE" for i in range(len(events)): t_fdsn_1 = datetime.now() target_path = os.path.join(eventpath, events[i]["event_id"]) if not input_dics["list_stas"]: Stas_fdsn = FDSN_available(input_dics, events[i], target_path, event_number=i) else: Stas_fdsn = read_list_stas(input_dics["list_stas"], input_dics["normal_mode_syn"], input_dics["specfem3D"]) if input_dics["fdsn_bulk"] == "Y": FDSN_create_bulk_list(target_path, input_dics, Stas_fdsn, events[i]) if input_dics["fdsn_bulk"] != "Y": print "\n%s-Availability for event: %s/%s ---> DONE" % (input_dics["fdsn_base_url"], i + 1, len(events)) else: print "\nFDSN-bulkfile for event: %s/%s ---> DONE" % (i + 1, len(events)) print "Time for checking the availability: %s" % (datetime.now() - t_fdsn_1) if Stas_fdsn != [[]]: FDSN_waveform(input_dics, events, Stas_fdsn, i, req_type="save") fdsn_url_orig = input_dics["fdsn_base_url"] for cli_rest in input_dics["fdsn_base_url_rest"]: try: from update_handler import FDSN_update input_dics["fdsn_base_url"] = cli_rest input_dics["fdsn_update"] = target_path FDSN_update(input_dics, address=target_path) except Exception, e: print e continue if len(input_dics["fdsn_base_url_rest"]) > 0: input_dics["fdsn_base_url"] = fdsn_url_orig input_dics["fdsn_update"] = "N" else: print "No available station in %s for your request and " "for event %s!" % ( input_dics["fdsn_base_url"], str(i + 1), ) continue
def FDSN_update(input_dics, address): """ Initialize directories and pass the required stations (removing the duplications) for FDSN update requests :param input_dics: :param address: :return: """ print '\n*********************' print 'FDSN -- Updating Mode' print '*********************' t_update_1 = datetime.now() events, address_events = quake_info(address, 'info') for i in range(len(events)): if not input_dics['list_stas']: Stas_fdsn = FDSN_available(input_dics, events[i], address_events[i], event_number=i) else: Stas_fdsn = read_list_stas(input_dics['list_stas'], input_dics['normal_mode_syn'], input_dics['specfem3D']) if input_dics['fdsn_bulk'] != 'Y': print '\n%s-Availability for event: %s/%s ---> DONE' \ % (input_dics['fdsn_base_url'], i+1, len(events)) else: print '\nFDSN-bulkfile for event: %s/%s ---> DONE' \ % (i+1, len(events)) if Stas_fdsn != [[]]: Stas_req = rm_duplicate(Stas_fdsn, address=os.path.join(address_events[i])) else: Stas_req = None print '------------------------------' print 'There is no available station!' print '------------------------------' if not os.path.isdir(os.path.join(address_events[i], 'BH_RAW')): os.makedirs(os.path.join(address_events[i], 'BH_RAW')) if Stas_req: FDSN_waveform(input_dics, events, Stas_req, i, req_type='update') else: print '\nNo available station in %s for your request!' \ % input_dics['fdsn_base_url'] print 'Check the next event...' continue print '\nTotal time for updating FDSN: %s' % (datetime.now() - t_update_1)
def FDSN_network(input_dics, events): """ Availability and retrieivng functions are called with FDSN_network :param input_dics: :param events: :return: """ print '\n********************************************************' print 'FDSN -- Download waveforms, StationXML files and meta-data' print '********************************************************' period = '{0:s}_{1:s}_{2:s}_{3:s}'.format( input_dics['min_date'].split('T')[0], input_dics['max_date'].split('T')[0], str(input_dics['min_mag']), str(input_dics['max_mag'])) eventpath = os.path.join(input_dics['datapath'], period) print 'Initializing folders and files...', create_folders_files(events, eventpath, input_dics) print 'DONE' for i in range(len(events)): t_fdsn_1 = datetime.now() target_path = os.path.join(eventpath, events[i]['event_id']) if not input_dics['list_stas']: Stas_fdsn = FDSN_available(input_dics, events[i], target_path, event_number=i) else: Stas_fdsn = read_list_stas(input_dics['list_stas'], input_dics['normal_mode_syn'], input_dics['specfem3D']) if input_dics['fdsn_bulk'] == 'Y': FDSN_create_bulk_list(target_path, input_dics, Stas_fdsn, events[i]) if input_dics['fdsn_bulk'] != 'Y': print '\n%s-Availability for event: %s/%s ---> DONE' \ % (input_dics['fdsn_base_url'], i+1, len(events)) else: print '\nFDSN-bulkfile for event: %s/%s ---> DONE' \ % (i+1, len(events)) print 'Time for checking the availability: %s' \ % (datetime.now() - t_fdsn_1) if Stas_fdsn != [[]]: FDSN_waveform(input_dics, events, Stas_fdsn, i, req_type='save') else: print 'No available station in %s for your request and ' \ 'for event %s!' % (input_dics['fdsn_base_url'], str(i+1)) continue
def FDSN_network(input_dics, events): """ Availability and retrieivng functions are called with FDSN_network :param input_dics: :param events: :return: """ print '\n********************************************************' print 'FDSN -- Download waveforms, StationXML files and meta-data' print '********************************************************' period = '{0:s}_{1:s}'.format( input_dics['min_date'].split('T')[0], input_dics['max_date'].split('T')[0]) eventpath = os.path.join(input_dics['datapath'], period) print 'Initializing folders and files...', create_folders_files(events, eventpath, input_dics) print 'DONE' for i in range(len(events)): t_fdsn_1 = datetime.now() target_path = os.path.join(eventpath, events[i]['event_id']) if not input_dics['list_stas']: Stas_fdsn = FDSN_available(input_dics, events[i], target_path, event_number=i) else: Stas_fdsn = read_list_stas(input_dics['list_stas'], input_dics['normal_mode_syn'], input_dics['specfem3D']) if input_dics['fdsn_bulk'] == 'Y': FDSN_create_bulk_list(target_path, input_dics, Stas_fdsn, events[i]) if input_dics['fdsn_bulk'] != 'Y': print '\n%s-Availability for event: %s/%s ---> DONE' \ % (input_dics['fdsn_base_url'], i+1, len(events)) else: print '\nFDSN-bulkfile for event: %s/%s ---> DONE' \ % (i+1, len(events)) print 'Time for checking the availability: %s' \ % (datetime.now() - t_fdsn_1) if Stas_fdsn != [[]]: FDSN_waveform(input_dics, events, Stas_fdsn, i, req_type='save') else: print 'No available station in %s for your request and ' \ 'for event %s!' % (input_dics['fdsn_base_url'], str(i+1)) continue
def ARC_update(input_dics, address): """ Initialize directories and pass the required stations (removing the duplications) for ArcLink update requests :param input_dics: :param address: :return: """ print '\n************************' print 'ArcLink -- Updating Mode' print '************************' t_update_1 = datetime.now() events, address_events = quake_info(address, 'info') for i in range(len(events)): if not input_dics['list_stas']: Stas_arc = ARC_available(input_dics, events[i], address_events[i], event_number=i) else: Stas_arc = read_list_stas(input_dics['list_stas'], input_dics['normal_mode_syn'], input_dics['specfem3D']) print '\nArcLink-Availability for event: %s/%s ---> DONE' \ % (i+1, len(events)) if Stas_arc != [[]]: Stas_req = rm_duplicate(Stas_arc, address=os.path.join(address_events[i])) else: Stas_req = None print '------------------------------' print 'There is no available station!' print '------------------------------' if not os.path.isdir(os.path.join(address_events[i], 'BH_RAW')): os.makedirs(os.path.join(address_events[i], 'BH_RAW')) if Stas_req: ARC_waveform(input_dics, events, Stas_req, i, req_type='update') else: print '\nNo available station in ArcLink for your request!' print 'Check the next event...' continue print '\nTotal time for updating ArcLink: %s' \ % (datetime.now() - t_update_1)
def ARC_network(input_dics, events): """ Returns information about what time series data is available at the ArcLink nodes for all requested events """ print '\n***********************************************************' print 'ArcLink -- Download waveforms, response files and meta-data' print '***********************************************************' period = '{0:s}_{1:s}_{2:s}_{3:s}'.format( input_dics['min_date'].split('T')[0], input_dics['max_date'].split('T')[0], str(input_dics['min_mag']), str(input_dics['max_mag'])) eventpath = os.path.join(input_dics['datapath'], period) if input_dics['FDSN'] != 'Y': print 'Initializing folders and files...', create_folders_files(events, eventpath, input_dics) print 'DONE' for i in range(len(events)): t_arc_1 = datetime.now() target_path = os.path.join(eventpath, events[i]['event_id']) if not input_dics['list_stas']: Stas_arc = ARC_available(input_dics, events[i], target_path, event_number=i) else: Stas_arc = read_list_stas(input_dics['list_stas'], normal_mode_syn='N', specfem3D='N') print '\nArcLink-Availability for event: %s/%s ---> DONE' \ % (i+1, len(events)) print 'Time for checking the availability: %s' \ % (datetime.now() - t_arc_1) if Stas_arc != [[]]: ARC_waveform(input_dics, events, Stas_arc, i, req_type='save') else: print 'No available station in ArcLink for your request and ' \ 'for event %s!' % str(i+1) continue