def geoproject(lat_p, lon_p, lat1, lon1, lat2, lon2): azi = distaz(lat1, lon1, lat2, lon2).baz dis_center = distaz(lat1, lon1, lat_p, lon_p).delta azi_center = distaz(lat1, lon1, lat_p, lon_p).baz dis_along = atand(tand(dis_center))*cosd(azi-azi_center) (lat, lon) = latlon_from(lat1, lon1, azi, dis_along) return lat, lon
def read_catalog(logpath, b_time, e_time, stla, stlo, magmin=5.5, magmax=10, dismin=30, dismax=90): col = ['date', 'evla', 'evlo', 'evdp', 'mag'] eq_lst = pd.DataFrame(columns=col) with open(logpath) as f: lines = f.readlines() for line in lines: line_sp = line.strip().split() date_now = obspy.UTCDateTime.strptime( '.'.join(line_sp[0:3]) + 'T' + '.'.join(line_sp[4:7]), '%Y.%m.%dT%H.%M.%S') evla = float(line_sp[7]) evlo = float(line_sp[8]) evdp = float(line_sp[9]) mw = float(line_sp[10]) dis = seispy.distaz(stla, stlo, evla, evlo).delta # bazi = seispy.distaz(stla, stlo, evla, evlo).getBaz() if b_time <= date_now <= e_time and magmin <= mw <= magmax and dismin <= dis <= dismax: this_data = pd.DataFrame([[date_now, evla, evlo, evdp, mw]], columns=col) eq_lst = eq_lst.append(this_data, ignore_index=True) return eq_lst
def prof_range(lat, lon): dis = [0] for i in range(lat.size - 1): dis.append( distaz(lat[i], lon[i], lat[i + 1], lon[i + 1]).degreesToKilometers()) return np.cumsum(dis)
def stack(self): """Search conversion points falling within a bin and stack them with bootstrap method. """ for i, bin_info in enumerate(self.bin_loca): boot_stack = {} bin_mu = np.zeros(self.cpara.stack_range.size) bin_ci = np.zeros([self.cpara.stack_range.size, 2]) bin_count = np.zeros(self.cpara.stack_range.size) self.logger.CCPlog.info( '{}/{} bin at lat: {:.3f} lon: {:.3f}'.format( i + 1, self.bin_loca.shape[0], bin_info[0], bin_info[1])) idxs = self._select_sta(bin_info[0], bin_info[1]) for j, dep in enumerate(self.cpara.stack_range): idx = int(j * self.stack_mul + self.cpara.stack_range[0] / self.cpara.dep_val) bin_dep_amp = np.array([]) for k in idxs: stop_idx = np.where(self.rfdep[k]['stopindex'] >= idx)[0] fall_idx = np.where( distaz(self.rfdep[k]['piercelat'][stop_idx, idx], self.rfdep[k]['piercelon'][stop_idx, idx], bin_info[0], bin_info[1]).delta < self.fzone[j])[0] bin_dep_amp = np.append( bin_dep_amp, self.rfdep[k]['moveout_correct'][stop_idx[fall_idx], idx]) bin_mu[j], bin_ci[j], bin_count[j] = boot_bin_stack( bin_dep_amp, n_samples=self.cpara.boot_samples) boot_stack['bin_lat'] = bin_info[0] boot_stack['bin_lon'] = bin_info[1] boot_stack['mu'] = bin_mu boot_stack['ci'] = bin_ci boot_stack['count'] = bin_count self.stack_data.append(boot_stack)
def find_falling(proj, cpara, profile_range, profile_lat, profile_lon, bin_radius): stack_data = np.zeros((profile_range.shape[0], 5), dtype=np.object) stack_rf = np.zeros([cpara.stack_range.shape[0], profile_range.shape[0]]) event_count = np.zeros( [cpara.stack_range.shape[0], profile_range.shape[0]]) dom = int(cpara.stack_val / cpara.dep_val) for i in range(profile_range.shape[0]): print( 'calculate the RF stacks at the distance of {}km along the profile-------' .format(profile_range[i])) for j in range(cpara.stack_range.shape[0]): for k in range(proj.shape[0]): col = np.where( distaz( profile_lat[i], profile_lon[i], proj[k]['projlat'][ int(dom * cpara.stack_range[j]), :], proj[k] ['projlon'][int(dom * cpara.stack_range[j]), :]).delta < bin_radius[j])[0] if col.size != 0: stack_rf[j, i] += np.sum( proj[k]['moveout_correct'][int(dom * cpara.stack_range[j]), col]) event_count[j, i] += col.shape[0] if event_count[j, i] > 0: stack_rf[j, i] /= event_count[j, i] stack_data[i, 0] = profile_lat[i] stack_data[i, 1] = profile_lon[i] stack_data[i, 2] = profile_range[i] stack_data[i, 3] = stack_rf[:, i] stack_data[i, 4] = event_count[:, i] return stack_data
def match_eq(eq_lst, pathname, stla, stlo, logger, ref_comp='Z', suffix='SAC', offset=None, tolerance=210, dateformat='%Y.%j.%H.%M.%S'): pattern = datestr2regex(dateformat) ref_eqs = glob.glob(join(pathname, '*{0}*{1}'.format(ref_comp, suffix))) if len(ref_eqs) == 0: raise SACFileNotFoundError( join(pathname, '*{0}*{1}'.format(ref_comp, suffix))) sac_files = [] for ref_sac in ref_eqs: try: datestr = re.findall(pattern, ref_sac)[0] except IndexError: raise IndexError('Error data format of {} in {}'.format( pattern, ref_sac)) if isinstance(offset, (int, float)): sac_files.append( [datestr, UTCDateTime.strptime(datestr, dateformat), -offset]) elif offset is None: try: tr = obspy.read(ref_sac)[0] except TypeError: continue sac_files.append( [datestr, tr.stats.starttime - tr.stats.sac.b, tr.stats.sac.o]) else: raise TypeError('offset should be int or float type') new_col = ['dis', 'bazi', 'data', 'datestr'] eq_match = pd.DataFrame(columns=new_col) for datestr, b_time, offs in sac_files: date_range_begin = b_time + timedelta(seconds=offs - tolerance) date_range_end = b_time + timedelta(seconds=offs + tolerance) results = eq_lst[(eq_lst.date > date_range_begin) & (eq_lst.date < date_range_end)] if len(results) != 1: continue try: this_eq = EQ(pathname, datestr, suffix) except Exception as e: logger.RFlog.error(''.format(e)) continue this_eq.get_time_offset(results.iloc[0]['date']) daz = distaz(stla, stlo, results.iloc[0]['evla'], results.iloc[0]['evlo']) this_df = pd.DataFrame([[daz.delta, daz.baz, this_eq, datestr]], columns=new_col, index=results.index.values) eq_match = pd.concat([eq_match, this_df]) ind = eq_match.index.drop_duplicates(keep=False) eq_match = eq_match.loc[ind] return pd.concat([eq_lst, eq_match], axis=1, join='inner')
def searcheq(stalat, stalon, daterange1, daterange2, gate_dis1, gate_dis2, gate_mw, evt_list): eq_lst = [] fid_evtlist = open(evt_list) for evt in fid_evtlist.readlines(): evt = evt.strip('\n') year_evt = int(evt.split()[0]) mon_evt = int(evt.split()[1]) day_evt = int(evt.split()[2]) hour_evt = int(evt.split()[4]) min_evt = int(evt.split()[5]) sec_evt = int(evt.split()[6]) lat_evt = float(evt.split()[7]) lon_evt = float(evt.split()[8]) dis_evt = seispy.distaz(stalat, stalon, lat_evt, lon_evt).delta bazi_evt = seispy.distaz(stalat, stalon, lat_evt, lon_evt).getBaz() dep_evt = float(evt.split()[9]) mw_evt = float(evt.split()[10]) date_evt = datetime.datetime(year_evt, mon_evt, day_evt, hour_evt, min_evt, sec_evt) if daterange1 <= date_evt <= daterange2 and gate_dis1 <= dis_evt <= gate_dis2 and mw_evt > gate_mw: matchedeq = [date_evt, lat_evt, lon_evt, dep_evt, dis_evt, bazi_evt, mw_evt] eq_lst.append(matchedeq) return eq_lst
def search_stations(cpara, da, staname, stla, stlo): global sta_num projstla, projstlo = geoproject(stla, stlo, cpara.line[0, 0], cpara.line[0, 1], cpara.line[1, 0], cpara.line[1, 1]) sta_dis = distaz(projstla, projstlo, stla, stlo).delta baz_sta_start = distaz(cpara.line[0, 0], cpara.line[0, 1], stla, stlo).baz baz_sta_end = distaz(cpara.line[1, 0], cpara.line[1, 1], stla, stlo).baz start_range = [np.mod(da.az + 90, 360), np.mod(da.az - 90, 360)] end_range = [np.mod(da.baz - 90, 360), np.mod(da.baz + 90, 360)] idx = np.where( ((baz_sta_start > start_range[0]) & (baz_sta_start < start_range[1])) & ((baz_sta_end < end_range[0]) | (baz_sta_end > end_range[1])) & (sta_dis < cpara.width))[0] if idx.size == 0: raise ValueError('No station beside this profile') if cpara.stack_sta_list != '': with open(cpara.stack_sta_list, 'w+') as f: for i in idx: f.write('{} {:3f} {:3f}\n'.format(staname[i], stla[i], stlo[i])) return idx, projstla, projstlo
def gen_center_bin(center_lat, center_lon, len_lat, len_lon, val): """ Create spaced grid point with coordinates of the center point in the area in spherical coordinates. :param center_lat: Latitude of the center point. :type center_lat: float :param center_lon: Longitude of the center point. :type center_lon: float :param len_lat: Half length in degree along latitude axis. :type len_lat: float :param len_lon: Half length in degree along longitude axis. :type len_lon: float :param val: Interval in degree between adjacent grid point. :type val: float :return: Coordinates of Grid points. :rtype: 2-D ndarray of floats with shape (n, 2), where n is the number of grid points. """ lats = np.arange(0, 2 * len_lat, val) lons = np.arange(0, 2 * len_lon, val) plat, plon = latlon_from(center_lat, center_lon, 0, 90) da = distaz(plat, plon, center_lat, center_lon) begx = -len_lon begy = -len_lat bin_loca = [] bin_mat = np.zeros([lats.size, lons.size, 2]) bin_map = np.zeros([lats.size, lons.size]).astype(int) n = 0 for j in range(lats.size): delyinc = j * val + begy delt = da.delta + delyinc for i in range(lons.size): azim = da.az + (begx + i * val) / cosd(delyinc) glat, glon = latlon_from(plat, plon, azim, delt) if glon > 180: glon -= 360 bin_loca.append([glat, glon]) bin_mat[j, i, 0] = glat bin_mat[j, i, 1] = glon bin_map[j, i] = n n += 1 return np.array(bin_loca), bin_mat, bin_map
head = o config.read(head) break lat1 = float(line.split('/')[0]) lon1 = float(line.split('/')[1]) lat2 = float(line.split('/')[2]) lon2 = float(line.split('/')[3]) depthdat = config.get('FileIO', 'depthdat') stackfile = config.get('FileIO', 'stackfile') # domperiod = float(config.get('para', 'domperiod')) Profile_width = float(config.get('para', 'Profile_width')) bin_radius = float(config.get('para', 'bin_radius')) Stack_range = np.arange(300, 751) smooth_para = 0.02 azi = seispy.distaz(lat1, lon1, lat2, lon2).baz dis = seispy.distaz(lat1, lon1, lat2, lon2).delta Profile_range = np.arange(0, seispy.geo.deg2km(dis), Profile_width) Profile_lat = [] Profile_lon = [] for Profile_loca in Profile_range: (lat_loca, lon_loca) = seispy.geo.latlon_from(lat1, lon1, azi, seispy.geo.km2deg(Profile_loca)) # Profile_lat = np.append(Profile_lat, [lat_loca], axis=1) # Profile_lon = np.append(Profile_lon, [lon_loca], axis=1) Profile_lat = np.append(Profile_lat, lat_loca) Profile_lon = np.append(Profile_lon, lon_loca) # ----- Read depth .mat file -----# depthmat = sio.loadmat(depthdat)
def match_eq(eq_lst, pathname, stla, stlo, ref_comp='Z', suffix='SAC', offset=None, tolerance=210, dateformat='%Y.%j.%H.%M.%S', switchEN=False, reverseE=False, reverseN=False): pattern = datestr2regex(dateformat) ref_eqs = glob.glob(join(pathname, '*{0}*{1}'.format(ref_comp, suffix))) sac_files = [] for ref_sac in ref_eqs: try: datestr = re.findall(pattern, ref_sac)[0] except IndexError: raise IndexError('Error data format in {}'.format(ref_sac)) if isinstance(offset, (int, float)): sac_files.append([ datestr, obspy.UTCDateTime.strptime(datestr, dateformat), -offset ]) elif offset is None: try: tr = obspy.read(ref_sac)[0] except TypeError: continue sac_files.append([datestr, tr.stats.starttime, tr.stats.sac.o]) else: raise TypeError('offset should be int or float type') # try: # tr = obspy.read(ref_sac)[0] # except TypeError: # continue # if offset is None: # this_offset = tr.stats.sac.o # elif isinstance(offset, (int, float)): # this_offset = -offset # else: # raise TypeError('offset should be int or float type') # sac_files.append([datestr, tr.stats.starttime, this_offset]) new_col = ['dis', 'bazi', 'data'] eq_match = pd.DataFrame(columns=new_col) for datestr, b_time, offs in sac_files: date_range_begin = b_time + timedelta(seconds=offs - tolerance) date_range_end = b_time + timedelta(seconds=offs + tolerance) results = eq_lst[(eq_lst.date > date_range_begin) & (eq_lst.date < date_range_end)] if len(results) != 1: continue try: this_eq = eq(pathname, datestr, suffix, switchEN=switchEN, reverseE=reverseE, reverseN=reverseN) except Exception as e: continue this_eq.get_time_offset(results.iloc[0]['date']) daz = seispy.distaz(stla, stlo, results.iloc[0]['evla'], results.iloc[0]['evlo']) this_df = pd.DataFrame([[daz.delta, daz.baz, this_eq]], columns=new_col, index=results.index.values) eq_match = eq_match.append(this_df) ind = eq_match.index.drop_duplicates(False) eq_match = eq_match.loc[ind] ''' for i, evt in eq_lst.iterrows(): tmp_datestr = [] for datestr, b_time, offs in sac_files: if b_time + timedelta(seconds=offs - tolerance) <= evt['date'] \ <= b_time + timedelta(seconds=offs + tolerance): tmp_datestr.append(datestr) if len(tmp_datestr) == 1: try: this_eq = eq(pathname, tmp_datestr[0], suffix) except: continue this_eq.get_time_offset(evt['date']) daz = seispy.distaz(stla, stlo, evt['evla'], evt['evlo']) this_df = pd.DataFrame([[daz.delta, daz.baz, this_eq]], columns=new_col, index=[i]) eq_match = eq_match.append(this_df) ''' return pd.concat([eq_lst, eq_match], axis=1, join='inner')
def _select_sta(self, bin_lat, bin_lon): return np.where( distaz(bin_lat, bin_lon, self.stalst[:, 0], self.stalst[:, 1]).delta <= self.dismin)[0]
VelocityModel = np.loadtxt(Velmod) Depths = VelocityModel[:, 0] Vs = VelocityModel[:, 2] Vs = interpolate.interp1d(Depths, Vs, kind='linear')(YAxisRange) # Stacking Stack_data = np.zeros([center.shape[0], 5], dtype=np.object) for i in range(center.shape[0]): print('Calculating %dth bin at %f/%f' % (i, center[i][0], center[i][1])) Stack_RF = np.zeros([Stack_range.shape[0], 1]) Event_count = np.zeros([Stack_range.shape[0], 1]) for j in range(Stack_range.shape[0]): # bin_radius = np.sqrt(0.5*domperiod*Vs[2*Stack_range[j] ]*Stack_range[j]) for k in range(RFdepth.shape[1]): if seispy.distaz(center[i][0], center[i][1], RFdepth[0, k]['stalat'][0][0], RFdepth[0, k]['stalon'][0][0]).delta >= 2: continue for l in range(RFdepth[0, k]['Piercelat'].shape[1]): if seispy.distaz( center[i][0], center[i][1], RFdepth[0, k]['Piercelat'][2 * Stack_range[j], l], RFdepth[0, k]['Piercelon'][2 * Stack_range[j], l] ).degreesToKilometers() < bin_radius: Stack_RF[j][0] += RFdepth[0, k]['moveout_correct'][ 2 * Stack_range[j], l] Event_count[j][0] += 1 if Event_count[j][0] > 0: Stack_RF[j][0] /= Event_count[j][0] Stack_data[i][0] = center[i][0] Stack_data[i][1] = center[i][1]
################################# eq_lst = [] ex_sac = obspy.read(glob.glob(os.path.join(data_path, staname, '*.'+comp+'.*[Ss][Aa][Cc]'))[0])[0] stalat = ex_sac.stats.sac.stla stalon = ex_sac.stats.sac.stlo for evt in fid_evtlist.readlines(): evt = evt.strip('\n') year_evt = int(evt.split()[0]) mon_evt = int(evt.split()[1]) day_evt = int(evt.split()[2]) hour_evt = int(evt.split()[4]) min_evt = int(evt.split()[5]) sec_evt = int(evt.split()[6]) lat_evt = float(evt.split()[7]) lon_evt = float(evt.split()[8]) dis_evt = seispy.distaz(stalat, stalon, lat_evt, lon_evt).delta bazi_evt = seispy.distaz(stalat, stalon, lat_evt, lon_evt).getBaz() dep_evt = float(evt.split()[9]) mw_evt = float(evt.split()[10]) date_evt = datetime.datetime(year_evt, mon_evt, day_evt, hour_evt, min_evt, sec_evt) if daterange1 <= date_evt <= daterange2 and gate_dis1 <= dis_evt <= gate_dis2 and mw_evt > gate_mw: matchedeq = [date_evt, lat_evt, lon_evt, dep_evt, dis_evt, bazi_evt, mw_evt] eq_lst.append(matchedeq) ################################# # -------- Assign Files --------# ################################# eq = [] for nowevt in eq_lst: find_result = [] for sac in glob.glob(os.path.join(data_path, staname, '*.'+comp+'.*[Ss][Aa][Cc]')):
config.read(head) break # read parameters lat1 = float(line.split('/')[0]) lon1 = float(line.split('/')[1]) lat2 = float(line.split('/')[2]) lon2 = float(line.split('/')[3]) depthdat = config.get('FileIO', 'depthdat') stackfile = config.get('FileIO', 'stackfile') Velmod = config.get('FileIO', 'Velmod') stalist = config.get('FileIO', 'stalist') domperiod = float(config.get('para', 'domperiod')) Profile_width = float(config.get('para', 'Profile_width')) Stack_range = np.arange(1, 101) azi = seispy.distaz(lat1, lon1, lat2, lon2).baz dis = seispy.distaz(lat1, lon1, lat2, lon2).delta Profile_range = np.arange(0, seispy.geo.deg2km(dis), Profile_width) Profile_lat = [] Profile_lon = [] for Profile_loca in Profile_range: (lat_loca, lon_loca) = seispy.geo.latlon_from(lat1, lon1, azi, seispy.geo.km2deg(Profile_loca)) Profile_lat = np.append(Profile_lat, [lat_loca], axis=1) Profile_lon = np.append(Profile_lon, [lon_loca], axis=1) # read depth data depthmat = sio.loadmat(depthdat) RFdepth = depthmat['YN_RFdepth'] # find stations beside the profile stalat_all = RFdepth[0, 0::]['stalat']
break # read parameters lat1 = float(line.split('/')[0]) lon1 = float(line.split('/')[1]) lat2 = float(line.split('/')[2]) lon2 = float(line.split('/')[3]) depthdat = config.get('FileIO', 'depthdat') stackfile = config.get('FileIO', 'stackfile') Velmod = config.get('FileIO', 'Velmod') stalist = config.get('FileIO', 'stalist') domperiod = float(config.get('para', 'domperiod')) Profile_width = float(config.get('para', 'Profile_width')) # proj_width = float(config.get('para', 'proj_width')) Stack_range = np.arange(1, 101) azi = seispy.distaz(lat1, lon1, lat2, lon2).baz dis = seispy.distaz(lat1, lon1, lat2, lon2).delta Profile_range = np.arange(0, seispy.geo.deg2km(dis), Profile_width) Profile_lat = [] Profile_lon = [] for Profile_loca in Profile_range: (lat_loca, lon_loca) = seispy.geo.latlon_from(lat1, lon1, azi, seispy.geo.km2deg(Profile_loca)) #print(lat_loca, lon_loca) Profile_lat = np.append(Profile_lat, [lat_loca]) Profile_lon = np.append(Profile_lon, [lon_loca]) # read depth data depthmat = sio.loadmat(depthdat) RFdepth = depthmat['YN_RFdepth']
Depths = VelocityModel[:, 0] Vs = VelocityModel[:, 2] Vs = interpolate.interp1d(Depths, Vs, kind="linear")(YAxisRange) # Stacking Stack_data = np.zeros([center.shape[0], 5], dtype=np.object) for i in range(center.shape[0]): print("Calculating %dth bin at %f/%f" % (i, center[i][0], center[i][1])) Stack_RF = np.zeros([Stack_range.shape[0], 1]) Event_count = np.zeros([Stack_range.shape[0], 1]) for j in range(Stack_range.shape[0]): # bin_radius = np.sqrt(0.5*domperiod*Vs[2*Stack_range[j] ]*Stack_range[j]) for k in range(RFdepth.shape[1]): if ( seispy.distaz( center[i][0], center[i][1], RFdepth[0, k]["stalat"][0][0], RFdepth[0, k]["stalon"][0][0] ).delta >= 2 ): continue for l in range(RFdepth[0, k]["Piercelat"].shape[1]): if ( seispy.distaz( center[i][0], center[i][1], RFdepth[0, k]["Piercelat"][2 * Stack_range[j], l], RFdepth[0, k]["Piercelon"][2 * Stack_range[j], l], ).degreesToKilometers() < bin_radius ): Stack_RF[j][0] += RFdepth[0, k]["moveout_correct"][2 * Stack_range[j], l]
################################# # --------- Search eq ----------# ################################# eq_lst = [] for evt in fid_evtlist.readlines(): evt = evt.strip('\n') year_evt = int(evt.split()[0]) mon_evt = int(evt.split()[1]) day_evt = int(evt.split()[2]) hour_evt = int(evt.split()[4]) min_evt = int(evt.split()[5]) sec_evt = int(evt.split()[6]) lat_evt = float(evt.split()[7]) lon_evt = float(evt.split()[8]) dis_evt = seispy.distaz(stalat, stalon, lat_evt, lon_evt).delta bazi_evt = seispy.distaz(stalat, stalon, lat_evt, lon_evt).getBaz() dep_evt = float(evt.split()[9]) mw_evt = float(evt.split()[10]) date_evt = datetime.datetime(year_evt, mon_evt, day_evt, hour_evt, min_evt, sec_evt) if daterange1 <= date_evt <= daterange2 and gate_dis1 <= dis_evt <= gate_dis2 and mw_evt > gate_mw: matchedeq = [ date_evt, lat_evt, lon_evt, dep_evt, dis_evt, bazi_evt, mw_evt ] eq_lst.append(matchedeq) ################################# # -------- Assign Files --------# ################################# eq = []
config.read(head) break # read parameters lat1 = float(line.split('/')[0]) lon1 = float(line.split('/')[1]) lat2 = float(line.split('/')[2]) lon2 = float(line.split('/')[3]) depthdat = config.get('FileIO', 'depthdat') stackfile = config.get('FileIO', 'stackfile') Velmod = config.get('FileIO', 'Velmod') stalist = config.get('FileIO', 'stalist') domperiod = float(config.get('para', 'domperiod')) Profile_width = float(config.get('para', 'Profile_width')) Stack_range = np.arange(1, 101) azi = seispy.distaz(lat1, lon1, lat2, lon2).baz dis = seispy.distaz(lat1, lon1, lat2, lon2).delta Profile_range = np.arange(0, seispy.geo.deg2km(dis), Profile_width) Profile_lat = [] Profile_lon = [] for Profile_loca in Profile_range: (lat_loca, lon_loca) = seispy.geo.latlon_from(lat1, lon1, azi, seispy.geo.km2deg(Profile_loca)) Profile_lat = np.append(Profile_lat, [lat_loca], axis=1) Profile_lon = np.append(Profile_lon, [lon_loca], axis=1) # read depth data depthmat = sio.loadmat(depthdat) RFdepth = depthmat['RFdepth'] # find stations beside the profile stalat_all = RFdepth[0, 0::]['stalat']
def gen_profile(lineloca, slid_val): da = distaz(lineloca[0, 0], lineloca[0, 1], lineloca[1, 0], lineloca[1, 1]) profile_range = np.arange(0, da.degreesToKilometers(), slid_val) profile_lat, profile_lon = latlon_from(lineloca[0, 0], lineloca[0, 1], da.baz, profile_range) return da, profile_range, profile_lat, profile_lon
head = o config.read(head) break lat1 = float(line.split('/')[0]) lon1 = float(line.split('/')[1]) lat2 = float(line.split('/')[2]) lon2 = float(line.split('/')[3]) depthdat = config.get('FileIO', 'depthdat') stackfile = config.get('FileIO', 'stackfile') # domperiod = float(config.get('para', 'domperiod')) Profile_width = float(config.get('para', 'Profile_width')) bin_radius = float(config.get('para', 'bin_radius')) Stack_range = np.arange(300, 751) smooth_para = 0.02 azi = seispy.distaz(lat1, lon1, lat2, lon2).baz dis = seispy.distaz(lat1, lon1, lat2, lon2).delta Profile_range = np.arange(0, seispy.geo.deg2km(dis), Profile_width) Profile_lat = [] Profile_lon = [] for Profile_loca in Profile_range: (lat_loca, lon_loca) = seispy.geo.latlon_from(lat1, lon1, azi, seispy.geo.km2deg(Profile_loca)) # Profile_lat = np.append(Profile_lat, [lat_loca], axis=1) # Profile_lon = np.append(Profile_lon, [lon_loca], axis=1) Profile_lat = np.append(Profile_lat, lat_loca) Profile_lon = np.append(Profile_lon, lon_loca) # ----- Read depth .mat file -----# depthmat = sio.loadmat(depthdat) RFdepth = depthmat['YN_RFdepth']