def test_peer2bbp(self): """ Test for the peer2bbp converter """ ref_dir = os.path.join(self.install.A_TEST_REF_DIR, "ucb") ## Retrieve PEER seismogram files in_n_file = os.path.join(ref_dir, "station.peer_n.acc") in_e_file = os.path.join(ref_dir, "station.peer_e.acc") in_z_file = os.path.join(ref_dir, "station.peer_z.acc") # Output file peer_out_bbp = os.path.join(self.outdir, "station.output.bbp") try: os.remove(peer_out_bbp) except: pass # Reference bbp filename peer_out_bbp_ref = os.path.join(ref_dir, "station.acc.bbp") bbp_formatter.peer2bbp(in_n_file, in_e_file, in_z_file, peer_out_bbp) print("created bbp file: %s" % (peer_out_bbp)) res_file = open(peer_out_bbp, 'r') lines = res_file.readlines() res_file.close() ref_file = open(peer_out_bbp_ref, 'r') rlines = ref_file.readlines() ref_file.close() # # Pass test if bbp file has more than 400 lines. # Only confirms that the bbp file is non-zero length # self.assertTrue(len(lines) == len(rlines)) # convert to bbp format # input to respect # retrieve amplitudes from respect # compare to amplitudes calculated by PEER return 0
def main(): # # Logic is # # ls the LOMAP dir # find each RNS # for each RSN create three names of the three components # for each RNS create name of output file based on RNS # call bbp_formatter # # # path = './LOMAP' listing = os.listdir(path) for infile in listing: print("current file is: " + infile) sta_list = [] for infile in listing: if infile.endswith("_E.acc" or "_N.acc" or "_Z.acc"): fields = infile.split("_") id = int(fields[0]) print("Found RECID %d" % (id)) sta_list.append(id) print("next infile") for sta in sta_list: e_fname = os.path.join(path, "%s_E.acc" % (sta)) n_fname = os.path.join(path, "%s_N.acc" % (sta)) z_fname = os.path.join(path, "%s_Z.acc" % (sta)) bbp_fname = os.path.join(path, "%s.bbp" % (sta)) print(e_fname) print(n_fname) print(z_fname) print(bbp_fname) bbp_formatter.peer2bbp(n_fname, e_fname, z_fname, bbp_fname) print("Created BBP file: %s" % (bbp_fname))
def calculate_observations(self, a_indir, a_statfile, a_tmpdir_seis, a_dstdir): """ This function calculates RotD100/RotD50 for the observation seismograms. It corrects the observations using the user-provided correction coefficients. """ sim_id = self.sim_id slo = StationList(a_statfile) site_list = slo.getStationList() # Inialize the CorrectPSA module if self.obs_corrections: corr_psa = CorrectPSA(self.r_stations, "rd100", os.path.join(a_indir, self.obs_corrections), a_tmpdir_seis, sim_id) else: corr_psa = None # List of observed seismogram files filelist = os.listdir(self.a_obsdir) # Go through each station for site in site_list: stat = site.scode print("==> Calculating observations RotD100 for station: %s" % (stat)) # Check if we have the corresponding calculated seismogram expected_calculated_file = os.path.join(a_dstdir, "%d.%s.rd100" % (sim_id, stat)) if not os.path.exists(expected_calculated_file): # Just skip it print("Couldn't find file: %s" % (expected_calculated_file) + "This is not necessarily an error, as you may have " + "run with a subset of a stations. Continuing " + "with available stations.") continue # Ok, we have a simulated seismogram for this station, # let's look for the observed file r_e_peer_file = None r_n_peer_file = None r_z_peer_file = None r_bbp_file = "%s.bbp" % (stat) # Do different things depending on the format of the # observed seismograms if self.obs_format == "acc_bbp": # We need to look for the bbp file if r_bbp_file not in filelist: # No bbp file for this station continue print(r_bbp_file) # Copy bbp file to the tmp seismogram directory a_src_bbp_file = os.path.join(self.a_obsdir, r_bbp_file) a_dst_bbp_file = os.path.join(a_tmpdir_seis, r_bbp_file) shutil.copy2(a_src_bbp_file, a_dst_bbp_file) # Now we need to create the peer files to process with rotd50 r_e_peer_file = os.path.join(a_tmpdir_seis, "%s_E.acc" % (stat)) r_n_peer_file = os.path.join(a_tmpdir_seis, "%s_N.acc" % (stat)) r_z_peer_file = os.path.join(a_tmpdir_seis, "%s_Z.acc" % (stat)) bbp_formatter.bbp2peer(a_dst_bbp_file, r_n_peer_file, r_e_peer_file, r_z_peer_file) elif self.obs_format == "acc_peer": # Look for the E, N, and Z files for my_file in filelist: if my_file.endswith("%s_E.acc" % (stat)): r_e_peer_file = my_file if (r_n_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_N.acc" % (stat)): r_n_peer_file = my_file if (r_e_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_Z.acc" % (stat)): r_z_peer_file = my_file if (r_e_peer_file is not None and r_n_peer_file is not None): break if ((r_e_peer_file is None) or (r_n_peer_file is None) or (r_z_peer_file is None)): # Couldn't find all 3 files continue #print(r_e_peer_file, r_n_peer_file, r_z_peer_file) # Copy all three files to the tmp seismogram directory for eachfile in (r_e_peer_file, r_n_peer_file, r_z_peer_file): a_src_peer_file = os.path.join(self.a_obsdir, eachfile) a_dst_peer_file = os.path.join(a_tmpdir_seis, eachfile) shutil.copy2(a_src_peer_file, a_dst_peer_file) # Now we need to convert them into bbp format bbp_formatter.peer2bbp(os.path.join(a_tmpdir_seis, r_n_peer_file), os.path.join(a_tmpdir_seis, r_e_peer_file), os.path.join(a_tmpdir_seis, r_z_peer_file), os.path.join(a_tmpdir_seis, r_bbp_file)) else: raise bband_utils.ParameterError("Format %s for " % (self.obs_format) + "observed seismograms " "not supported") # Run RotD100 on this file if corr_psa is not None: # First calculate rd100/50 and psa5 files self.do_rotd100(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, r_z_peer_file, "%s-orig.rd100" % (stat), self.log) # Now we need to correct the RotD100/RotD50 output # using the user-supplied correction factors corr_psa.correct_station(stat, "rd100") else: # Use final names for output files self.do_rotd100(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, r_z_peer_file, "%s.rd100" % (stat), self.log) shutil.copy2(os.path.join(a_tmpdir_seis, "%s.rd100" % (stat)), os.path.join(a_dstdir, "%s.rd100" % (stat)))
def run(self): """ This function copies the observed seismograms for the stations specified in r_stations to a temporary directory inside the tmpdata directory and converts them to the format needed by the goodness of fitness module """ print("ObsSeismograms".center(80, '-')) # Initialize basic variables install = InstallCfg.getInstance() sim_id = self.sim_id sta_base = os.path.basename(os.path.splitext(self.r_stations)[0]) self.log = os.path.join(install.A_OUT_LOG_DIR, str(sim_id), "%d.obs_seis.log" % (sim_id)) # Input, tmp, and output directories a_indir = os.path.join(install.A_IN_DATA_DIR, str(sim_id)) a_tmpdir = os.path.join(install.A_TMP_DATA_DIR, str(sim_id)) a_tmpdir_seis = os.path.join(install.A_TMP_DATA_DIR, str(sim_id), "obs_seis_%s" % (sta_base)) a_outdir = os.path.join(install.A_OUT_DATA_DIR, str(sim_id)) a_outdir_seis = os.path.join(a_outdir, "obs_seis_%s" % (sta_base)) a_outdir_gmpe = os.path.join(a_outdir, "gmpe_data_%s" % (sta_base)) # # Make sure the output and tmp directories exist # dirs = [ a_tmpdir, a_tmpdir_seis, a_outdir, a_outdir_seis, a_outdir_gmpe ] bband_utils.mkdirs(dirs, print_cmd=False) # Station file a_statfile = os.path.join(a_indir, self.r_stations) # List of observed seismogram files filelist = os.listdir(self.a_obsdir) slo = StationList(a_statfile) site_list = slo.getStationList() # Inialize the CorrectPSA module if self.obs_corrections: corr_psa = CorrectPSA(self.r_stations, "rd100", os.path.join(a_indir, self.obs_corrections), a_tmpdir_seis, sim_id) else: corr_psa = None # Go through each station for site in site_list: slon = float(site.lon) slat = float(site.lat) stat = site.scode print("==> Processing data for station: %s" % (stat)) # Look for the files we need expected_rd50_file = os.path.join(a_outdir, "%d.%s.rd50" % (sim_id, stat)) if not os.path.exists(expected_rd50_file): # just skip it print("Couldn't find file %s. " % (expected_rd50_file) + "This is not necessarily an error, as you may have " + "run with a subset of a stations. Continuing " + "with available stations.") continue # Ok, we have a calculated rd50/rd100 files for this station, # let's look for the observed file r_e_peer_file = None r_n_peer_file = None r_z_peer_file = None r_bbp_file = "%s.bbp" % (stat) # Do different things depending on the format of the # observed seismograms if self.obs_format == "acc_bbp": # We need to look for the bbp file if r_bbp_file not in filelist: # No bbp file for this station continue print("==> Converting file: %s" % (r_bbp_file)) # Copy bbp file to the tmp seismogram directory a_src_bbp_file = os.path.join(self.a_obsdir, r_bbp_file) a_dst_bbp_file = os.path.join(a_tmpdir_seis, r_bbp_file) shutil.copy2(a_src_bbp_file, a_dst_bbp_file) # Now we need to create the peer files to process with rotd50 r_e_peer_file = os.path.join(a_tmpdir_seis, "%s_E.acc" % (stat)) r_n_peer_file = os.path.join(a_tmpdir_seis, "%s_N.acc" % (stat)) r_z_peer_file = os.path.join(a_tmpdir_seis, "%s_Z.acc" % (stat)) bbp_formatter.bbp2peer(a_dst_bbp_file, r_n_peer_file, r_e_peer_file, r_z_peer_file) elif self.obs_format == "acc_peer": # Look for the E, N, and Z files for my_file in filelist: if my_file.endswith("%s_E.acc" % (stat)): r_e_peer_file = my_file if (r_n_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_N.acc" % (stat)): r_n_peer_file = my_file if (r_e_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_Z.acc" % (stat)): r_z_peer_file = my_file if (r_e_peer_file is not None and r_n_peer_file is not None): break if ((r_e_peer_file is None) or (r_n_peer_file is None) or (r_z_peer_file is None)): # Couldn't find all 3 files continue # print(r_e_peer_file, r_n_peer_file, r_z_peer_file) # Copy all three files to the tmp seismogram directory for eachfile in (r_e_peer_file, r_n_peer_file, r_z_peer_file): a_src_peer_file = os.path.join(self.a_obsdir, eachfile) a_dst_peer_file = os.path.join(a_tmpdir_seis, eachfile) shutil.copy2(a_src_peer_file, a_dst_peer_file) # Now we need to convert them into bbp format bbp_formatter.peer2bbp( os.path.join(a_tmpdir_seis, r_n_peer_file), os.path.join(a_tmpdir_seis, r_e_peer_file), os.path.join(a_tmpdir_seis, r_z_peer_file), os.path.join(a_tmpdir_seis, r_bbp_file)) elif self.obs_format == "gmpe": # GMPE verification packages don't have actual # seismograms, so there's nothing we need to do here! a_src_gmpe_file = os.path.join(a_outdir_gmpe, "%s-gmpe.ri50" % (stat)) # Create a copy in outdata averaging all gmpes a_avg_rd50_file = os.path.join(a_outdir_seis, "%s.rd50" % (stat)) gmpe_config.average_gmpe(stat, a_src_gmpe_file, a_avg_rd50_file) # All done! continue else: raise bband_utils.ParameterError("Format %s for " % (self.obs_format) + "observed seismograms " "not supported") out_rotd100_base = "%s.rd100" % (stat) out_rotd100v_base = "%s.rd100.vertical" % (stat) out_rotd50_base = "%s.rd50" % (stat) out_rotd50v_base = "%s.rd50.vertical" % (stat) # Run RotDXX on this file if corr_psa is not None: # First calculate rdXX print("===> Calculating RotDXX for station: %s" % (stat)) rotd100.do_rotd100(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, "%s-orig.rd100" % (stat), self.log) #rotd100.do_rotd100(a_tmpdir_seis, r_z_peer_file, # r_z_peer_file, # "%s-orig.rd100.vertical" % (stat), self.log) # Now we need to correct the RotD100 outputs using the # user-supplied correction factors print("===> Correcting PSA for station: %s" % (stat)) corr_psa.correct_station(stat, "rd100") #corr_psa.correct_station(stat, "rd100.vertical") else: # Use final names for output files print("===> Calculating RotDXX for station: %s" % (stat)) rotd100.do_rotd100(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, out_rotd100_base, self.log) #rotd100.do_rotd100(a_tmpdir_seis, r_z_peer_file, # r_z_peer_file, # out_rotd100v_base % (stat), self.log) # Create rotd50 files as well rotd100.do_split_rotd50(a_tmpdir_seis, out_rotd100_base, out_rotd50_base, self.log) #rotd100.do_split_rotd50(a_tmpdir_seis, out_rotd100v_base, # out_rotd50v_base, self.log) shutil.copy2(os.path.join(a_tmpdir_seis, out_rotd100_base), os.path.join(a_outdir_seis, out_rotd100_base)) #shutil.copy2(os.path.join(a_tmpdir_seis, out_rotd100v_base), # os.path.join(a_outdir_seis, out_rotd100v_base)) shutil.copy2(os.path.join(a_tmpdir_seis, out_rotd50_base), os.path.join(a_outdir_seis, out_rotd50_base)) #shutil.copy2(os.path.join(a_tmpdir_seis, out_rotd50v_base), # os.path.join(a_outdir_seis, out_rotd50v_base)) print("ObsSeismograms Completed".center(80, '-'))
def calculate_observations(self, a_indir, a_statfile, a_tmpdir_seis, a_dstdir): """ This function calculates RotD100/RotD50 for the observation seismograms. It corrects the observations using the user-provided correction coefficients. """ sim_id = self.sim_id slo = StationList(a_statfile) site_list = slo.getStationList() # Inialize the CorrectPSA module if self.obs_corrections: corr_psa = CorrectPSA(self.r_stations, "rd100", os.path.join(a_indir, self.obs_corrections), a_tmpdir_seis, sim_id) else: corr_psa = None # List of observed seismogram files filelist = os.listdir(self.a_obsdir) # Go through each station for site in site_list: stat = site.scode print("==> Calculating observations RotD100 for station: %s" % (stat)) # Check if we have the corresponding calculated seismogram expected_calculated_file = os.path.join( a_dstdir, "%d.%s.rd100" % (sim_id, stat)) if not os.path.exists(expected_calculated_file): # Just skip it print("Couldn't find file: %s" % (expected_calculated_file) + "This is not necessarily an error, as you may have " + "run with a subset of a stations. Continuing " + "with available stations.") continue # Ok, we have a simulated seismogram for this station, # let's look for the observed file r_e_peer_file = None r_n_peer_file = None r_z_peer_file = None r_bbp_file = "%s.bbp" % (stat) # Do different things depending on the format of the # observed seismograms if self.obs_format == "acc_bbp": # We need to look for the bbp file if r_bbp_file not in filelist: # No bbp file for this station continue print(r_bbp_file) # Copy bbp file to the tmp seismogram directory a_src_bbp_file = os.path.join(self.a_obsdir, r_bbp_file) a_dst_bbp_file = os.path.join(a_tmpdir_seis, r_bbp_file) shutil.copy2(a_src_bbp_file, a_dst_bbp_file) # Now we need to create the peer files to process with rotd50 r_e_peer_file = os.path.join(a_tmpdir_seis, "%s_E.acc" % (stat)) r_n_peer_file = os.path.join(a_tmpdir_seis, "%s_N.acc" % (stat)) r_z_peer_file = os.path.join(a_tmpdir_seis, "%s_Z.acc" % (stat)) bbp_formatter.bbp2peer(a_dst_bbp_file, r_n_peer_file, r_e_peer_file, r_z_peer_file) elif self.obs_format == "acc_peer": # Look for the E, N, and Z files for my_file in filelist: if my_file.endswith("%s_E.acc" % (stat)): r_e_peer_file = my_file if (r_n_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_N.acc" % (stat)): r_n_peer_file = my_file if (r_e_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_Z.acc" % (stat)): r_z_peer_file = my_file if (r_e_peer_file is not None and r_n_peer_file is not None): break if ((r_e_peer_file is None) or (r_n_peer_file is None) or (r_z_peer_file is None)): # Couldn't find all 3 files continue #print(r_e_peer_file, r_n_peer_file, r_z_peer_file) # Copy all three files to the tmp seismogram directory for eachfile in (r_e_peer_file, r_n_peer_file, r_z_peer_file): a_src_peer_file = os.path.join(self.a_obsdir, eachfile) a_dst_peer_file = os.path.join(a_tmpdir_seis, eachfile) shutil.copy2(a_src_peer_file, a_dst_peer_file) # Now we need to convert them into bbp format bbp_formatter.peer2bbp( os.path.join(a_tmpdir_seis, r_n_peer_file), os.path.join(a_tmpdir_seis, r_e_peer_file), os.path.join(a_tmpdir_seis, r_z_peer_file), os.path.join(a_tmpdir_seis, r_bbp_file)) else: raise bband_utils.ParameterError("Format %s for " % (self.obs_format) + "observed seismograms " "not supported") # Run RotD100 on this file if corr_psa is not None: # First calculate rd100/50 and psa5 files do_rotd100(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, "%s-orig.rd100" % (stat), self.log) # Now we need to correct the RotD100/RotD50 output # using the user-supplied correction factors corr_psa.correct_station(stat, "rd100") else: # Use final names for output files do_rotd100(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, "%s.rd100" % (stat), self.log) shutil.copy2(os.path.join(a_tmpdir_seis, "%s.rd100" % (stat)), os.path.join(a_dstdir, "%s.rd100" % (stat)))
def run(self): """ This function copies the observed seismograms for the stations specified in r_stations to a temporary directory inside the tmpdata directory and converts them to the format needed by the goodness of fitness module """ print("ObsSeismograms".center(80, '-')) # Initialize basic variables install = InstallCfg.getInstance() sim_id = self.sim_id sta_base = os.path.basename(os.path.splitext(self.r_stations)[0]) self.log = os.path.join(install.A_OUT_LOG_DIR, str(sim_id), "%d.obs_seis.log" % (sim_id)) # Input, tmp, and output directories a_indir = os.path.join(install.A_IN_DATA_DIR, str(sim_id)) a_tmpdir = os.path.join(install.A_TMP_DATA_DIR, str(sim_id)) a_tmpdir_seis = os.path.join(install.A_TMP_DATA_DIR, str(sim_id), "obs_seis_%s" % (sta_base)) a_outdir = os.path.join(install.A_OUT_DATA_DIR, str(sim_id)) a_outdir_seis = os.path.join(a_outdir, "obs_seis_%s" % (sta_base)) # # Make sure the output and tmp directories exist # dirs = [a_tmpdir, a_tmpdir_seis, a_outdir, a_outdir_seis] bband_utils.mkdirs(dirs, print_cmd=False) # Station file a_statfile = os.path.join(a_indir, self.r_stations) # List of observed seismogram files filelist = os.listdir(self.a_obsdir) slo = StationList(a_statfile) site_list = slo.getStationList() # Inialize the CorrectPSA module if self.obs_corrections: corr_psa = CorrectPSA(self.r_stations, "rd50", os.path.join(a_indir, self.obs_corrections), a_tmpdir_seis, self.sim_id) else: corr_psa = None # Go through each station for site in site_list: slon = float(site.lon) slat = float(site.lat) stat = site.scode print("==> Processing data for station: %s" % (stat)) # Since we're using the GP station list, make sure the # .rd50 for the station exists. It might not if we ran the # validation with a different station list (like UCSB for # Landers) expected_rd50_file = os.path.join(a_outdir, "%d.%s.rd50" % (sim_id, stat)) if not os.path.exists(expected_rd50_file): # just skip it print("Couldn't find file %s. " % (expected_rd50_file) + "This is not necessarily an error, as you may have " + "run with a subset of a stations. Continuing " + "with available stations.") continue # Ok, we have a calculated rd50 file for this station, # let's look for the observed file r_e_peer_file = None r_n_peer_file = None r_z_peer_file = None r_bbp_file = "%s.bbp" % (stat) # Do different things depending on the format of the # observed seismograms if self.obs_format == "acc_bbp": # We need to look for the bbp file if r_bbp_file not in filelist: # No bbp file for this station continue print("==> Converting file: %s" % (r_bbp_file)) # Copy bbp file to the tmp seismogram directory a_src_bbp_file = os.path.join(self.a_obsdir, r_bbp_file) a_dst_bbp_file = os.path.join(a_tmpdir_seis, r_bbp_file) shutil.copy2(a_src_bbp_file, a_dst_bbp_file) # Now we need to create the peer files to process with rotd50 r_e_peer_file = os.path.join(a_tmpdir_seis, "%s_E.acc" % (stat)) r_n_peer_file = os.path.join(a_tmpdir_seis, "%s_N.acc" % (stat)) r_z_peer_file = os.path.join(a_tmpdir_seis, "%s_Z.acc" % (stat)) bbp_formatter.bbp2peer(a_dst_bbp_file, r_n_peer_file, r_e_peer_file, r_z_peer_file) elif self.obs_format == "acc_peer": # Look for the E, N, and Z files for my_file in filelist: if my_file.endswith("%s_E.acc" % (stat)): r_e_peer_file = my_file if (r_n_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_N.acc" % (stat)): r_n_peer_file = my_file if (r_e_peer_file is not None and r_z_peer_file is not None): break elif my_file.endswith("%s_Z.acc" % (stat)): r_z_peer_file = my_file if (r_e_peer_file is not None and r_n_peer_file is not None): break if ((r_e_peer_file is None) or (r_n_peer_file is None) or (r_z_peer_file is None)): # Couldn't find all 3 files continue # print(r_e_peer_file, r_n_peer_file, r_z_peer_file) # Copy all three files to the tmp seismogram directory for eachfile in (r_e_peer_file, r_n_peer_file, r_z_peer_file): a_src_peer_file = os.path.join(self.a_obsdir, eachfile) a_dst_peer_file = os.path.join(a_tmpdir_seis, eachfile) shutil.copy2(a_src_peer_file, a_dst_peer_file) # Now we need to convert them into bbp format bbp_formatter.peer2bbp(os.path.join(a_tmpdir_seis, r_n_peer_file), os.path.join(a_tmpdir_seis, r_e_peer_file), os.path.join(a_tmpdir_seis, r_z_peer_file), os.path.join(a_tmpdir_seis, r_bbp_file)) elif self.obs_format == "gmpe": # GMPE verification packages don't have actual # seismograms, so there's nothing we need to do here! r_gmpe_file = "%s-gmpe.ri50" % (stat) if r_gmpe_file not in filelist: # No gmpe file for this station continue # Copy gmpe file to the tmp obs directory and rename # it so that it has a rd50 extension a_src_gmpe_file = os.path.join(self.a_obsdir, r_gmpe_file) a_dst_rd50_file = os.path.join(a_tmpdir_seis, "%s.rd50" % (stat)) shutil.copy2(a_src_gmpe_file, a_dst_rd50_file) # Create a copy in outdata that averages all gmpes a_avg_rd50_file = os.path.join(a_outdir_seis, "%s.rd50" % (stat)) gmpe_config.average_gmpe(stat, a_src_gmpe_file, a_avg_rd50_file) # All done! continue else: raise bband_utils.ParameterError("Format %s for " % (self.obs_format) + "observed seismograms " "not supported") # Run RotD50 on this file if corr_psa is not None: # First calculate rd50 and psa5 files print("===> Calculating RotD50 for station: %s" % (stat)) RotD50.do_rotd50(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, r_z_peer_file, "%s-orig.rd50" % (stat), self.log) # Now we need to correct the RotD50 output using the # user-supplied correction factors print("===> Correcting PSA for station: %s" % (stat)) corr_psa.correct_station(stat, "rd50") else: # Use final names for output files print("===> Calculating RotD50 for station: %s" % (stat)) RotD50.do_rotd50(a_tmpdir_seis, r_e_peer_file, r_n_peer_file, r_z_peer_file, "%s.rd50" % (stat), self.log) shutil.copy2(os.path.join(a_tmpdir_seis, "%s.rd50" % (stat)), os.path.join(a_outdir_seis, "%s.rd50" % (stat))) print("ObsSeismograms Completed".center(80, '-'))