From b8f8a401ca949e376ef273d02c6f5c20dd76e516 Mon Sep 17 00:00:00 2001 From: Fabio Silva Date: Wed, 27 Sep 2023 16:07:19 -0700 Subject: [PATCH] Renamed methods in StationList class to follow pep 8 style guide. --- bbp/comps/anderson_gof.py | 6 ++--- bbp/comps/as16.py | 6 ++--- bbp/comps/bbtoolbox.py | 4 ++-- bbp/comps/bbtoolbox_correlation.py | 6 ++--- bbp/comps/calculate_gmpe.py | 6 ++--- bbp/comps/cc.py | 6 ++--- bbp/comps/copy_seismograms.py | 6 ++--- bbp/comps/correct_psa.py | 6 ++--- bbp/comps/csm.py | 12 +++++----- bbp/comps/exsim.py | 8 +++---- bbp/comps/fas.py | 6 ++--- bbp/comps/fas_gof.py | 6 ++--- bbp/comps/gen_plots.py | 6 ++--- bbp/comps/genhtml.py | 6 ++--- bbp/comps/geobb_srf.py | 6 ++--- bbp/comps/gmpe_comparison.py | 6 ++--- bbp/comps/gmpe_plot.py | 6 ++--- bbp/comps/gp_gof.py | 6 ++--- bbp/comps/hfsims.py | 6 ++--- bbp/comps/irikura_hf.py | 12 +++++----- bbp/comps/jbsim.py | 6 ++--- bbp/comps/lf_seismograms.py | 6 ++--- bbp/comps/match.py | 6 ++--- bbp/comps/obs_seismograms.py | 6 ++--- bbp/comps/plot_seis.py | 6 ++--- bbp/comps/plot_seismograms.py | 4 ++-- bbp/comps/plot_utils.py | 8 +++---- bbp/comps/plot_value_map.py | 8 +++---- bbp/comps/rotd100.py | 14 +++++------ bbp/comps/rotd50.py | 6 ++--- bbp/comps/rzz2015.py | 6 ++--- bbp/comps/rzz2015_gmpe.py | 6 ++--- bbp/comps/sdsu_mogof.py | 4 ++-- bbp/comps/sdsu_seismograms.py | 6 ++--- bbp/comps/seismo_soil.py | 6 ++--- bbp/comps/stas2files.py | 20 ++++++++-------- bbp/comps/station_list.py | 24 +++++++++++-------- bbp/comps/syn1D.py | 8 +++---- bbp/comps/uc_site.py | 6 ++--- bbp/comps/uc_stitch.py | 6 ++--- bbp/comps/wcc_siteamp.py | 6 ++--- bbp/tests/test_anderson_gof.py | 8 +++---- bbp/tests/test_rzz2015.py | 6 ++--- bbp/tests/test_uc_site.py | 6 ++--- .../batch/bbp_merge_multisegment_scenario.py | 8 +++---- .../bbp_merge_multisegment_validation.py | 6 ++--- bbp/utils/batch/combine_anderson_gof.py | 2 +- bbp/utils/batch/combine_bbp_data_19_4.py | 6 ++--- bbp/utils/batch/combine_rd100_bias_gen.py | 6 ++--- bbp/utils/batch/combine_rzz2015_plot_gen.py | 6 ++--- bbp/utils/batch/gmpe_comparison_gen.py | 6 ++--- bbp/utils/misc/calculate_distance.py | 6 ++--- .../misc/export_bbp_cluster_simulation.py | 6 ++--- bbp/utils/misc/export_bbp_simulation.py | 6 ++--- bbp/utils/misc/gen_comparison_plots.py | 6 ++--- bbp/utils/misc/import_bbp_simulation.py | 6 ++--- bbp/utils/misc/merge_multisegment_scenario.py | 8 +++---- .../misc/merge_multisegment_validation.py | 6 ++--- bbp/utils/misc/plot_gof_comparison.py | 6 ++--- bbp/utils/misc/plot_seismogram_comparison.py | 6 ++--- 60 files changed, 210 insertions(+), 206 deletions(-) diff --git a/bbp/comps/anderson_gof.py b/bbp/comps/anderson_gof.py index caae1f0e..ffb03272 100755 --- a/bbp/comps/anderson_gof.py +++ b/bbp/comps/anderson_gof.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -874,7 +874,7 @@ def run(self): # Read station list slo = StationList(sta_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Figure out station names station_names = [] diff --git a/bbp/comps/as16.py b/bbp/comps/as16.py index 86257e91..9895e3fc 100755 --- a/bbp/comps/as16.py +++ b/bbp/comps/as16.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -442,7 +442,7 @@ def run(self): # Get station list slo = StationList(sta_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Create output file, add header out_file = open(os.path.join(a_validation_outdir, diff --git a/bbp/comps/bbtoolbox.py b/bbp/comps/bbtoolbox.py index 84584ae7..901ad37c 100755 --- a/bbp/comps/bbtoolbox.py +++ b/bbp/comps/bbtoolbox.py @@ -1,8 +1,8 @@ -#!/bin/env python +#!/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bbp/comps/bbtoolbox_correlation.py b/bbp/comps/bbtoolbox_correlation.py index f3ab39b2..1260155b 100644 --- a/bbp/comps/bbtoolbox_correlation.py +++ b/bbp/comps/bbtoolbox_correlation.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -255,7 +255,7 @@ def generate_matrices(sdsu_data_dir, lf_seis_dir, # Figure out how long LF seismograms are slo = StationList(station_file) - station_list = slo.getStationList() + station_list = slo.get_station_list() station_id = station_list[0].scode lf_file = os.path.join(lf_seis_dir, "%d.%s-lf.bbp" % (sim_id, station_id)) ts_dt = get_dt(lf_file) diff --git a/bbp/comps/calculate_gmpe.py b/bbp/comps/calculate_gmpe.py index e2312d53..519acdf8 100644 --- a/bbp/comps/calculate_gmpe.py +++ b/bbp/comps/calculate_gmpe.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -172,7 +172,7 @@ def run(self): self.r_stations) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Go through each station, and print comparison headers for # the first station we process diff --git a/bbp/comps/cc.py b/bbp/comps/cc.py index dfbc953f..c38f204f 100755 --- a/bbp/comps/cc.py +++ b/bbp/comps/cc.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ def oll2xy(slo, ofile, mlon, mlat, x_azim): This will work as long at the station list has both lat/lon and XY in it. """ # install = InstallCfg() - site_list = slo.getStationList() + site_list = slo.get_station_list() out_file = open(ofile, "w") out_file.write("% station coordinates in x,y system, " "origin at fault center\n") diff --git a/bbp/comps/copy_seismograms.py b/bbp/comps/copy_seismograms.py index 995b4d3e..e45f5e28 100644 --- a/bbp/comps/copy_seismograms.py +++ b/bbp/comps/copy_seismograms.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ def run(self): # Read and parse the statioin list with this call # slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() for sits in site_list: site = sits.scode diff --git a/bbp/comps/correct_psa.py b/bbp/comps/correct_psa.py index 28da7072..846f3aa1 100755 --- a/bbp/comps/correct_psa.py +++ b/bbp/comps/correct_psa.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -225,7 +225,7 @@ def run(self): a_statfile = os.path.join(a_indir, self.r_stations) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Go through each station # print "Working dir: %s" % (self.proc_dir) diff --git a/bbp/comps/csm.py b/bbp/comps/csm.py index 336818ea..492aaa22 100644 --- a/bbp/comps/csm.py +++ b/bbp/comps/csm.py @@ -1,8 +1,8 @@ -#!/bin/env python +#!/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -81,7 +81,7 @@ def create_mod_files(self): cfgparams = self.config.cfgparams # Create a velocity model file for each station - for station in self.stat_list.getStationList(): + for station in self.stat_list.get_station_list(): vmodel_file = os.path.join(self.csm_dir, "%s.mod" % station.scode) outfile = open(vmodel_file, 'w') @@ -135,7 +135,7 @@ def create_station_list(self): (self.config.cfgparams["hypolat"], self.config.cfgparams["hypolon"])) outfile.write("%5i\n" % (len(self.stat_list.site_list))) - for station in self.stat_list.getStationList(): + for station in self.stat_list.get_station_list(): outfile.write("%4s %12.5f %12.5f %20s\n" % (station.scode, station.lat, @@ -150,7 +150,7 @@ def create_simula_stations(self): simula_stations = os.path.join(self.csm_dir, self.config.simula_stations) outfile = open(simula_stations, 'w') - for station in self.stat_list.getStationList(): + for station in self.stat_list.get_station_list(): outfile.write("%s\n" % (station.scode)) outfile.write("ENDX00\n") outfile.close() @@ -294,7 +294,7 @@ def process_seismograms(self): generated the velocity and acceleration seismograms in the BBP format needed by the platform """ - for station in self.stat_list.getStationList(): + for station in self.stat_list.get_station_list(): in_file = os.path.join(self.csm_dir, "%s.sim01" % (station.scode)) out_vel_file = os.path.join(self.install.A_OUT_DATA_DIR, diff --git a/bbp/comps/exsim.py b/bbp/comps/exsim.py index 49f64549..d8906d77 100755 --- a/bbp/comps/exsim.py +++ b/bbp/comps/exsim.py @@ -1,8 +1,8 @@ -#!/bin/env python +#!/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -381,7 +381,7 @@ def create_exsim_param_file(self): self.template_replace([""], [""]) # Almost done, now we need to add stations - site_list = self.stat_list.getStationList() + site_list = self.stat_list.get_station_list() # Check for maximum number of stations if len(site_list) > self.config.MAX_STATIONS: @@ -466,7 +466,7 @@ def run(self): # Need to copy and re-format output files output_stem = "exsim-output-%s" % (sta_base) - site_list = self.stat_list.getStationList() + site_list = self.stat_list.get_station_list() for site, idx in zip(site_list, range(1, self.num_stations + 1)): stat = site.scode diff --git a/bbp/comps/fas.py b/bbp/comps/fas.py index 6d1c2548..c41ba2e1 100755 --- a/bbp/comps/fas.py +++ b/bbp/comps/fas.py @@ -2,7 +2,7 @@ """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -839,7 +839,7 @@ def run_scenario(self): bband_utils.mkdirs([a_tmpdir, a_outdir, a_outdir_fas], print_cmd=False) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Save current directory old_cwd = os.getcwd() @@ -957,7 +957,7 @@ def run_validation(self): bband_utils.mkdirs([a_tmpdir, a_outdir, a_outdir_fas], print_cmd=False) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Save current directory old_cwd = os.getcwd() diff --git a/bbp/comps/fas_gof.py b/bbp/comps/fas_gof.py index ea1da699..35a1fff6 100755 --- a/bbp/comps/fas_gof.py +++ b/bbp/comps/fas_gof.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -358,7 +358,7 @@ def run(self): self.r_stations) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # check cutoff value if self.max_cutoff is None: diff --git a/bbp/comps/gen_plots.py b/bbp/comps/gen_plots.py index 05775fb9..3677ee20 100644 --- a/bbp/comps/gen_plots.py +++ b/bbp/comps/gen_plots.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -83,7 +83,7 @@ def run(self): filelist = os.listdir(a_tmpdir_seis) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: stat = site.scode diff --git a/bbp/comps/genhtml.py b/bbp/comps/genhtml.py index 769aac05..8c16bb90 100755 --- a/bbp/comps/genhtml.py +++ b/bbp/comps/genhtml.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -123,7 +123,7 @@ def run(self): # Read and parse the station list with this call # slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() index_file = os.path.join(a_outdir, "index-%d.html" % (sim_id)) idxout = open(index_file, 'w') diff --git a/bbp/comps/geobb_srf.py b/bbp/comps/geobb_srf.py index 33264093..ce21a681 100755 --- a/bbp/comps/geobb_srf.py +++ b/bbp/comps/geobb_srf.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -467,7 +467,7 @@ def run(self, slo, coord_out_file, fault_out_file, if slo is None: raise bband_utils.ParameterError("Cannot open station list") - site_list = slo.getStationList() + site_list = slo.get_station_list() slon = [] slat = [] site = [] diff --git a/bbp/comps/gmpe_comparison.py b/bbp/comps/gmpe_comparison.py index 9778a567..524480e0 100644 --- a/bbp/comps/gmpe_comparison.py +++ b/bbp/comps/gmpe_comparison.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -258,7 +258,7 @@ def run(self): self.r_stations) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Go through each station, and print comparison headers for # the first station we process diff --git a/bbp/comps/gmpe_plot.py b/bbp/comps/gmpe_plot.py index 3540c3ef..ef93c3ef 100755 --- a/bbp/comps/gmpe_plot.py +++ b/bbp/comps/gmpe_plot.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -101,7 +101,7 @@ def run(self): filelist = os.listdir(a_outdir_gmpe) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Go through each station for site in site_list: diff --git a/bbp/comps/gp_gof.py b/bbp/comps/gp_gof.py index cf7a44bb..89f91bf7 100755 --- a/bbp/comps/gp_gof.py +++ b/bbp/comps/gp_gof.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -170,7 +170,7 @@ def run(self): filelist = os.listdir(a_outdir_seis) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # check cutoff value if self.max_cutoff is None: diff --git a/bbp/comps/hfsims.py b/bbp/comps/hfsims.py index 011b4c5a..3ad33dc7 100755 --- a/bbp/comps/hfsims.py +++ b/bbp/comps/hfsims.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -285,7 +285,7 @@ def run(self): # list that is returned has one station per line in it. # slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() nstat = len(site_list) # Create rayset param list diff --git a/bbp/comps/irikura_hf.py b/bbp/comps/irikura_hf.py index 48a0f446..7af89069 100644 --- a/bbp/comps/irikura_hf.py +++ b/bbp/comps/irikura_hf.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -340,7 +340,7 @@ def create_velocity_file(self, vel_file, vel_file_p): out_file.write("%d %d %4.2f %d\n" % (idx + 1, vs_m[idx], rho[idx], round(qs[idx]))) out_file.write("# LAYER-DEPTH(GL-m)\n") - for idx, _ in enumerate(self.stat_list.getStationList(), 1): + for idx, _ in enumerate(self.stat_list.get_station_list(), 1): out_file.write("%d %d %d" % (idx, 0, 0)) for item in depth: out_file.write(" %.1f" % (item)) @@ -356,7 +356,7 @@ def create_velocity_file(self, vel_file, vel_file_p): out_file.write("%d %d %4.2f %d\n" % (idx + 1, vp_m[idx], rho[idx], round(qs[idx]))) out_file.write("# LAYER-DEPTH(GL-m)\n") - for idx, _ in enumerate(self.stat_list.getStationList(), 1): + for idx, _ in enumerate(self.stat_list.get_station_list(), 1): out_file.write("%d %d %d" % (idx, 0, 0)) for item in depth: out_file.write(" %.1f" % (item)) @@ -373,7 +373,7 @@ def create_station_list(self, station_file): This function creates the Irikura recipe station list """ out_file = open(station_file, 'w') - for idx, station in enumerate(self.stat_list.getStationList(), 1): + for idx, station in enumerate(self.stat_list.get_station_list(), 1): out_file.write("%d\t%9.5f\t%9.5f\t0.0 \tSAS%s.dat\n" % (idx, station.lat, station.lon, station.scode)) out_file.close() @@ -549,7 +549,7 @@ def process_seismograms(self, irikura_dir): acc_ver_dir = os.path.join(irikura_dir, "VER", "acc") tmp_dir = os.path.join(self.install.A_TMP_DATA_DIR, str(self.sim_id)) - for idx, station in enumerate(self.stat_list.getStationList()): + for idx, station in enumerate(self.stat_list.get_station_list()): in_hor_file = os.path.join(acc_hor_dir, "ac%06d.dat" % (idx + 1)) in_ver_file = os.path.join(acc_ver_dir, "ac%06d.dat" % (idx + 1)) out_acc_file = os.path.join(tmp_dir, "%d.%s-hf.acc.bbp" % diff --git a/bbp/comps/jbsim.py b/bbp/comps/jbsim.py index 95f746d1..6733b422 100755 --- a/bbp/comps/jbsim.py +++ b/bbp/comps/jbsim.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -91,7 +91,7 @@ def run(self): # Read and parse the station list with this call # slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() for sits in site_list: slon = float(sits.lon) diff --git a/bbp/comps/lf_seismograms.py b/bbp/comps/lf_seismograms.py index f2c4ddcc..bf56e0df 100644 --- a/bbp/comps/lf_seismograms.py +++ b/bbp/comps/lf_seismograms.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -68,7 +68,7 @@ def run(self): print(self.seis_dir) slo = StationList(a_stations) - stat_list = slo.getStationList() + stat_list = slo.get_station_list() for stat in stat_list: # Look for bbp seismogram, copy in print("%s/%s-lf.bbp" % (self.seis_dir, stat.scode)) diff --git a/bbp/comps/match.py b/bbp/comps/match.py index 01b727b9..a22d448f 100755 --- a/bbp/comps/match.py +++ b/bbp/comps/match.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -107,7 +107,7 @@ def run(self): # Read and parse the station list with this call # slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Get pointer to the velocity model object vel_obj = velocity_models.get_velocity_model_by_name(self.vmodel_name) diff --git a/bbp/comps/obs_seismograms.py b/bbp/comps/obs_seismograms.py index 79c43b34..31ce4148 100755 --- a/bbp/comps/obs_seismograms.py +++ b/bbp/comps/obs_seismograms.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -114,7 +114,7 @@ def run(self): filelist = os.listdir(self.a_obsdir) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Inialize the CorrectPSA module if self.obs_corrections: diff --git a/bbp/comps/plot_seis.py b/bbp/comps/plot_seis.py index 24fcb266..5fc10411 100755 --- a/bbp/comps/plot_seis.py +++ b/bbp/comps/plot_seis.py @@ -1,8 +1,8 @@ -#!/usr/bin/python +#!/usr/bin/python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -90,7 +90,7 @@ def run(self): a_statlist = os.path.join(a_indir, self.r_stations) slo = StationList(a_statlist) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Get fault information, if available if self.src_keys is not None: diff --git a/bbp/comps/plot_seismograms.py b/bbp/comps/plot_seismograms.py index 34037a95..9777c616 100755 --- a/bbp/comps/plot_seismograms.py +++ b/bbp/comps/plot_seismograms.py @@ -1,8 +1,8 @@ -#!/usr/bin/python +#!/usr/bin/python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bbp/comps/plot_utils.py b/bbp/comps/plot_utils.py index c75f1520..0e26cf2b 100755 --- a/bbp/comps/plot_utils.py +++ b/bbp/comps/plot_utils.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -129,7 +129,7 @@ def write_simple_stations(station_file, out_file): This function parses the station file and writes a simple version with just longitude, latitude, and station code """ - stl = StationList(station_file).getStationList() + stl = StationList(station_file).get_station_list() fp_out = open(out_file, 'w') for stat in stl: fp_out.write("%f %f %s\n" % (stat.lon, stat.lat, stat.scode)) @@ -420,7 +420,7 @@ def set_boundaries_from_stations(station_file, a_input_file): bband_utils.ParameterError("Cannot determine input_file format!") # First we read the stations - stations = StationList(station_file).getStationList() + stations = StationList(station_file).get_station_list() # Now go through each one, keeping track of its locations for station in stations: # If this is the first station, use its location diff --git a/bbp/comps/plot_value_map.py b/bbp/comps/plot_value_map.py index 7aba7a82..19be68a7 100755 --- a/bbp/comps/plot_value_map.py +++ b/bbp/comps/plot_value_map.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -108,7 +108,7 @@ def init_dims(self): # a_statfile = (self.install.A_IN_DATA_DIR + # "/%d/%s"%(self.sim_id,self.station_file)) slo = StationList(self.station_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() w_lon = 0.0 e_lon = 0.0 n_lat = 0.0 @@ -197,7 +197,7 @@ def build_station_list(self, station_file): # a_statfile = (self.install.A_IN_DATA_DIR + # "/%d/%s"%(self.sim_id,self.station_file)) slo = StationList(self.station_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() for sites in site_list: slon = float(sites.lon) diff --git a/bbp/comps/rotd100.py b/bbp/comps/rotd100.py index e50c66ae..b8620490 100644 --- a/bbp/comps/rotd100.py +++ b/bbp/comps/rotd100.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -158,7 +158,7 @@ def calculate_simulated(self, a_statfile, a_tmpdir, a_outdir, a_dstdir): install = install_cfg.InstallCfg.getInstance() sim_id = self.sim_id slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: stat = site.scode @@ -282,7 +282,7 @@ def calculate_observations(self, a_indir, a_statfile, a_tmpdir_seis, a_dstdir): """ sim_id = self.sim_id slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Inialize the CorrectPSA module if self.obs_corrections: @@ -463,7 +463,7 @@ def calculate_ratios(self, a_statfile, a_dstdir): """ sim_id = self.sim_id slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Loop through all stations for site in site_list: @@ -487,7 +487,7 @@ def calculate_residuals(self, a_statfile, a_dstdir): install = install_cfg.InstallCfg.getInstance() sim_id = self.sim_id slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() print_header = 1 rd100_resid_output = os.path.join(a_dstdir, "%s-%d-resid-rd100.txt" % @@ -570,7 +570,7 @@ def generate_plot(self, a_statfile, a_dstdir): install = install_cfg.InstallCfg.getInstance() sim_id = self.sim_id slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() rd100_resid_output = os.path.join(a_dstdir, "%s-%d-resid-rd100.txt" % (self.comp_label, sim_id)) diff --git a/bbp/comps/rotd50.py b/bbp/comps/rotd50.py index 0060b18c..a218a41d 100644 --- a/bbp/comps/rotd50.py +++ b/bbp/comps/rotd50.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -125,7 +125,7 @@ def run(self): bband_utils.mkdirs([a_tmpdir, a_outdir], print_cmd=False) slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: stat = site.scode diff --git a/bbp/comps/rzz2015.py b/bbp/comps/rzz2015.py index 7aa7d6a8..00187bad 100755 --- a/bbp/comps/rzz2015.py +++ b/bbp/comps/rzz2015.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -881,7 +881,7 @@ def run(self): # Get station list slo = StationList(sta_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Create output file, add header out_file = open(os.path.join(a_validation_outdir, diff --git a/bbp/comps/rzz2015_gmpe.py b/bbp/comps/rzz2015_gmpe.py index 7fc158b8..d290cea4 100644 --- a/bbp/comps/rzz2015_gmpe.py +++ b/bbp/comps/rzz2015_gmpe.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -295,7 +295,7 @@ def run(self): # Get station list slo = StationList(sta_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Initialize random seed np.random.seed(int(self.src_keys['seed'])) diff --git a/bbp/comps/sdsu_mogof.py b/bbp/comps/sdsu_mogof.py index a1d7fdce..93dd993b 100644 --- a/bbp/comps/sdsu_mogof.py +++ b/bbp/comps/sdsu_mogof.py @@ -2,7 +2,7 @@ """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1128,7 +1128,7 @@ def run(self): (a_statfile)) sys.exit(-1) - site_list = slo.getStationList() + site_list = slo.get_station_list() print("Opening Station list %s." % (a_statfile)) diff --git a/bbp/comps/sdsu_seismograms.py b/bbp/comps/sdsu_seismograms.py index b4d6429b..0823a898 100755 --- a/bbp/comps/sdsu_seismograms.py +++ b/bbp/comps/sdsu_seismograms.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -130,7 +130,7 @@ def run(self): # Create list of stations to save slo = StationList(a_stations) - site_list = slo.getStationList() + site_list = slo.get_station_list() save_stat_names = [] for stat in site_list: save_stat_names.append(stat.scode) diff --git a/bbp/comps/seismo_soil.py b/bbp/comps/seismo_soil.py index cc538068..c17f6eae 100755 --- a/bbp/comps/seismo_soil.py +++ b/bbp/comps/seismo_soil.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -297,7 +297,7 @@ def run(self): # Read and parse the station list with this call # slo = StationList(a_stations) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: station_name = site.scode diff --git a/bbp/comps/stas2files.py b/bbp/comps/stas2files.py index 089acb29..0e387cdc 100755 --- a/bbp/comps/stas2files.py +++ b/bbp/comps/stas2files.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -50,7 +50,7 @@ def stationlist2filelist(slo): Input a stationlist object (slo). From this extract the station codes and create a list of file names that represent long period data files """ - site_list = slo.getStationList() + site_list = slo.get_station_list() files = [] for sta in site_list: fname = "%s" % (sta.scode) @@ -65,7 +65,7 @@ def gp_subset(in_file1, in_format1, in_file2, outfile): """ #Get a station list from in_file1 if in_format1 == 'GP' or in_format1 == 'UCSB': - stat_list = StationList(in_file1).getStationList() + stat_list = StationList(in_file1).get_station_list() stat_names = [stat.scode for stat in stat_list] elif in_format1 == 'SDSU': stat_file_fp = open(in_file1, 'r') @@ -86,7 +86,7 @@ def gp_subset(in_file1, in_format1, in_file2, outfile): # Use the station list to subset in_file2 intersect_list = [] - stat2_list = StationList(in_file2).getStationList() + stat2_list = StationList(in_file2).get_station_list() for stat2 in stat2_list: for stat1 in stat_names: if stat2.scode == stat1: @@ -148,7 +148,7 @@ def sdsu_subset(working_dir, stat_list_obj, val_obj, sdsu_out_list, vs_synths[pieces[2]] = full_vssynth_data[j - i - 1] # Now select only the stations present also in the stat_list_obj - for stat in stat_list_obj.getStationList(): + for stat in stat_list_obj.get_station_list(): #print stat.scode if stat.scode in stat_line: stl_out.write(stat_line[stat.scode]) @@ -186,7 +186,7 @@ def bbp2sdsu_statlist(working_dir, slo, sdsu_stalist, coords_fp.close() # Write station file - stat_list = slo.getStationList() + stat_list = slo.get_station_list() stalist_fp = open(sdsu_stalist, 'w') for i in range(0, len(stat_list)): pieces = coords_data[i].split() @@ -203,7 +203,7 @@ def bbp2sdsu_vsfiles(working_dir, slo, vsrealfile, vssynthfile): """ Produces VSREAL from station list and VSSYNTH (always 865) """ - stat_list = slo.getStationList() + stat_list = slo.get_station_list() # Write VSREAL and VSSYNTH files in working_dir if vsrealfile is not None: @@ -229,7 +229,7 @@ def gp2uc_stalist(slo, uc_stalist, uc_vs30): Convert this into a UCSB format station list containing lat/lon values. Values in list are strings at this time. """ - sl = slo.getStationList() + sl = slo.get_station_list() f = open(uc_stalist, "w") vs = open(uc_vs30, "w") num = len(sl) @@ -263,7 +263,7 @@ def sdsu2uc_subset(sdsu_stat_file, uc_stalist_in, uc_vs30_in, stat_names.append(pieces[2]) new_list = [] - slo = StationList(uc_stalist_in).getStationList() + slo = StationList(uc_stalist_in).get_station_list() for stat in stat_names: for entry in slo: if stat == entry.scode: diff --git a/bbp/comps/station_list.py b/bbp/comps/station_list.py index 1ac2428a..c8e42d8b 100755 --- a/bbp/comps/station_list.py +++ b/bbp/comps/station_list.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -69,12 +69,15 @@ def __init__(self, a_station_list=None): # Open file try: station_file = open(self.a_station_filename, "r") - except IOError: + except OSError: print("Error opening station list file : ", a_station_list) sys.exit(-1) # Read lines one by one for line in station_file: + line = line.strip() + if not line: + continue if line.startswith("#"): continue sta = line.split() @@ -108,7 +111,7 @@ def __init__(self, a_station_list=None): # Remember to close the file try: station_file.close - except IOError: + except OSError: print("Error closing station list file :", a_station_list) # Error message if we weren't able to read any stations if len(self.site_list) == 0: @@ -123,16 +126,18 @@ def build(stat_list, output_file): fp = open(output_file, 'w') for stat in stat_list: if stat.vs30 is not None: + # Write file with all fields fp.write("%f\t%f\t%s\t%d\t%f\t%f\n" % (stat.lon, stat.lat, stat.scode, stat.vs30, stat.low_freq_corner, stat.high_freq_corner)) else: + # Use short station list format fp.write("%f\t%f\t%f\n" % (stat.lon, stat.lat, stat.scode)) fp.flush() fp.close() - def getStationList(self): + def get_station_list(self): """ Returns our station list """ @@ -140,8 +145,7 @@ def getStationList(self): if __name__ == "__main__": print("Testing Module: %s" % (sys.argv[0])) - sl = StationList(sys.argv[1]) - ME = sl.getStationList() - for x in ME: - print(x.priority) - sys.exit(0) + STATION_LIST = StationList(sys.argv[1]) + ME = STATION_LIST.get_station_list() + for STATION in ME: + print(STATION.scode) diff --git a/bbp/comps/syn1D.py b/bbp/comps/syn1D.py index a351d985..0ed33b05 100755 --- a/bbp/comps/syn1D.py +++ b/bbp/comps/syn1D.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -164,7 +164,7 @@ def run_stitch(self, a_tmpdir_stitch, a_tmpdir_lf, # Write VMname.list file vmname_file = open(os.path.join(a_tmpdir_stitch, "VMname.list"), 'w') - site_list = self.slo.getStationList() + site_list = self.slo.get_station_list() for _ in site_list: vmname_file.write("%s\n" % (r_velmodel)) vmname_file.close() @@ -266,7 +266,7 @@ def run(self): a_stations = os.path.join(self.a_indir, self.r_stations) print(a_stations) self.slo = StationList(a_stations) - site_list = self.slo.getStationList() + site_list = self.slo.get_station_list() # Make sure syn1D can handle our station list if len(site_list) > self.cfg.MAX_STATIONS: diff --git a/bbp/comps/uc_site.py b/bbp/comps/uc_site.py index 854deac9..d77d8fc7 100755 --- a/bbp/comps/uc_site.py +++ b/bbp/comps/uc_site.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -253,7 +253,7 @@ def run(self): a_stations = os.path.join(a_indir, self.r_stations) print(a_stations) slo = StationList(a_stations) - site_list = slo.getStationList() + site_list = slo.get_station_list() # This is not a UCSB format station list, convert station # list to UCSB format, generating the station file and the diff --git a/bbp/comps/uc_stitch.py b/bbp/comps/uc_stitch.py index 20b78e49..9281c8c3 100755 --- a/bbp/comps/uc_stitch.py +++ b/bbp/comps/uc_stitch.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -181,7 +181,7 @@ def run(self): a_stations = os.path.join(a_indir, self.r_stations) print(a_stations) slo = StationList(a_stations) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Need stations in UCSB LL format a_uc_stations = os.path.join(a_tmpdir_mod, "stations.ll") diff --git a/bbp/comps/wcc_siteamp.py b/bbp/comps/wcc_siteamp.py index bfb4971a..23050849 100755 --- a/bbp/comps/wcc_siteamp.py +++ b/bbp/comps/wcc_siteamp.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -449,7 +449,7 @@ def run(self): # Read and parse the station list with this call # slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() for sites in site_list: site = sites.scode diff --git a/bbp/tests/test_anderson_gof.py b/bbp/tests/test_anderson_gof.py index 9294b8bd..22627885 100755 --- a/bbp/tests/test_anderson_gof.py +++ b/bbp/tests/test_anderson_gof.py @@ -1,8 +1,8 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -82,7 +82,7 @@ def setUp(self): # Read station list slo = StationList(os.path.join(a_indir, self.stations)) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Loop over stations for site in site_list: @@ -145,7 +145,7 @@ def test_anderson_gof(self): # Read station list slo = StationList(os.path.join(self.install.A_IN_DATA_DIR, str(self.sim_id), self.stations)) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Loop over stations for site in site_list: diff --git a/bbp/tests/test_rzz2015.py b/bbp/tests/test_rzz2015.py index 357ef465..d11109b4 100755 --- a/bbp/tests/test_rzz2015.py +++ b/bbp/tests/test_rzz2015.py @@ -1,8 +1,8 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -81,7 +81,7 @@ def setUp(self): # Read station list slo = StationList(os.path.join(a_indir, self.stations)) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Loop over stations for site in site_list: diff --git a/bbp/tests/test_uc_site.py b/bbp/tests/test_uc_site.py index 169c48f4..797cd0b4 100755 --- a/bbp/tests/test_uc_site.py +++ b/bbp/tests/test_uc_site.py @@ -1,8 +1,8 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ def setUp(self): # Copy seismograms slo = StationList(os.path.join(a_indir, self.r_stations)) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: shutil.copy2(os.path.join(a_refdir, "%s.3comp" % (site.scode)), a_tmpdir) diff --git a/bbp/utils/batch/bbp_merge_multisegment_scenario.py b/bbp/utils/batch/bbp_merge_multisegment_scenario.py index 6deb4873..7f723f99 100755 --- a/bbp/utils/batch/bbp_merge_multisegment_scenario.py +++ b/bbp/utils/batch/bbp_merge_multisegment_scenario.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ def post_process(station_list, src_files, # Load station list slo = StationList(station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: stat = site.scode @@ -196,7 +196,7 @@ def merge_seismograms(input_sims, station_list, """ # Load station list slo = StationList(station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Merge each station for station in site_list: diff --git a/bbp/utils/batch/bbp_merge_multisegment_validation.py b/bbp/utils/batch/bbp_merge_multisegment_validation.py index 587c8d74..02c8a843 100755 --- a/bbp/utils/batch/bbp_merge_multisegment_validation.py +++ b/bbp/utils/batch/bbp_merge_multisegment_validation.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -201,7 +201,7 @@ def merge_seismograms(input_sims, station_list, """ # Load station list slo = StationList(station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Merge each station for station in site_list: diff --git a/bbp/utils/batch/combine_anderson_gof.py b/bbp/utils/batch/combine_anderson_gof.py index ba84394e..048fdd22 100755 --- a/bbp/utils/batch/combine_anderson_gof.py +++ b/bbp/utils/batch/combine_anderson_gof.py @@ -376,7 +376,7 @@ def load_all_data(input_indir, input_outdir): raise bband_utils.ProcessingError("Cannot get station list!") a_statfile = a_statfile[0] slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Go through all stations for site in site_list: diff --git a/bbp/utils/batch/combine_bbp_data_19_4.py b/bbp/utils/batch/combine_bbp_data_19_4.py index 0956482c..c218c246 100755 --- a/bbp/utils/batch/combine_bbp_data_19_4.py +++ b/bbp/utils/batch/combine_bbp_data_19_4.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -180,7 +180,7 @@ def create_resid_data_file(comp_label, input_indir, input_obsdir, raise bband_utils.ProcessingError("Cannot get station list!") a_statfile = a_statfile[0] slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Get source file a_srcfile = glob.glob("%s%s*.src" % (basedir, os.sep)) diff --git a/bbp/utils/batch/combine_rd100_bias_gen.py b/bbp/utils/batch/combine_rd100_bias_gen.py index b250963d..e619bb07 100755 --- a/bbp/utils/batch/combine_rd100_bias_gen.py +++ b/bbp/utils/batch/combine_rd100_bias_gen.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -230,7 +230,7 @@ def create_resid_data_file(comp_label, input_indir, input_obsdir, raise bband_utils.ProcessingError("Cannot get station list!") a_statfile = a_statfile[0] slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Get source file a_srcfile = glob.glob("%s%s*.src" % (basedir, os.sep)) diff --git a/bbp/utils/batch/combine_rzz2015_plot_gen.py b/bbp/utils/batch/combine_rzz2015_plot_gen.py index e7fde878..9ccc988c 100755 --- a/bbp/utils/batch/combine_rzz2015_plot_gen.py +++ b/bbp/utils/batch/combine_rzz2015_plot_gen.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -236,7 +236,7 @@ def load_all_data(comp_label, input_indir, input_obsdir, raise bband_utils.ProcessingError("Cannot get station list!") a_statfile = a_statfile[0] slo = StationList(a_statfile) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Get source file a_srcfile = glob.glob("%s%s*.src" % (basedir, os.sep)) diff --git a/bbp/utils/batch/gmpe_comparison_gen.py b/bbp/utils/batch/gmpe_comparison_gen.py index 812a2ec2..15d1dc73 100644 --- a/bbp/utils/batch/gmpe_comparison_gen.py +++ b/bbp/utils/batch/gmpe_comparison_gen.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -183,7 +183,7 @@ def create_gmpe_data_file(indata_dir, tmpdir, stl_file = stl_file[0] # Parse station list slo = StationList(stl_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Write ri50 files rrups = [] diff --git a/bbp/utils/misc/calculate_distance.py b/bbp/utils/misc/calculate_distance.py index e69ffae2..8c3067f1 100755 --- a/bbp/utils/misc/calculate_distance.py +++ b/bbp/utils/misc/calculate_distance.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -109,7 +109,7 @@ def calculate_distance(): else: # Process station list slo = StationList(args.station_list) - stations = slo.getStationList() + stations = slo.get_station_list() for station in stations: site_geom = [float(station.lon), float(station.lat), 0.0] (fault_trace1, up_seis_depth, diff --git a/bbp/utils/misc/export_bbp_cluster_simulation.py b/bbp/utils/misc/export_bbp_cluster_simulation.py index 35bc783b..742cd137 100755 --- a/bbp/utils/misc/export_bbp_cluster_simulation.py +++ b/bbp/utils/misc/export_bbp_cluster_simulation.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -635,7 +635,7 @@ def collect_realization_params(args, realization): # Parse STL file slo = StationList(stl_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() station_names = [] for site in site_list: station_names.append(site.scode) diff --git a/bbp/utils/misc/export_bbp_simulation.py b/bbp/utils/misc/export_bbp_simulation.py index 18fabd54..005278cf 100755 --- a/bbp/utils/misc/export_bbp_simulation.py +++ b/bbp/utils/misc/export_bbp_simulation.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -207,7 +207,7 @@ def collect_realization_params(args, realization): # Parse STL file slo = StationList(stl_file) - site_list = slo.getStationList() + site_list = slo.get_station_list() station_names = [] for site in site_list: station_names.append(site.scode) diff --git a/bbp/utils/misc/gen_comparison_plots.py b/bbp/utils/misc/gen_comparison_plots.py index a11050b0..03714d97 100755 --- a/bbp/utils/misc/gen_comparison_plots.py +++ b/bbp/utils/misc/gen_comparison_plots.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -345,7 +345,7 @@ def main(): params = parse_arguments() slo = StationList(params["station_list"]) - station_list = slo.getStationList() + station_list = slo.get_station_list() for site in station_list: station = site.scode diff --git a/bbp/utils/misc/import_bbp_simulation.py b/bbp/utils/misc/import_bbp_simulation.py index 028cab27..546bb267 100755 --- a/bbp/utils/misc/import_bbp_simulation.py +++ b/bbp/utils/misc/import_bbp_simulation.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -114,7 +114,7 @@ def copy_seismograms(args, outdata): This function copies seismograms into the outdata directory """ slo = StationList(args.station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: station_name = site.scode diff --git a/bbp/utils/misc/merge_multisegment_scenario.py b/bbp/utils/misc/merge_multisegment_scenario.py index 5ae03b58..9ef6d753 100755 --- a/bbp/utils/misc/merge_multisegment_scenario.py +++ b/bbp/utils/misc/merge_multisegment_scenario.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -242,7 +242,7 @@ def merge_seismograms(self): """ # Load station list slo = StationList(self.station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Merge each station for station in site_list: @@ -318,7 +318,7 @@ def post_process(self): # Load station list slo = StationList(self.station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() for site in site_list: stat = site.scode diff --git a/bbp/utils/misc/merge_multisegment_validation.py b/bbp/utils/misc/merge_multisegment_validation.py index 272489a2..b6710704 100755 --- a/bbp/utils/misc/merge_multisegment_validation.py +++ b/bbp/utils/misc/merge_multisegment_validation.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -252,7 +252,7 @@ def merge_seismograms(self): """ # Load station list slo = StationList(self.station_list) - site_list = slo.getStationList() + site_list = slo.get_station_list() # Merge each station for station in site_list: diff --git a/bbp/utils/misc/plot_gof_comparison.py b/bbp/utils/misc/plot_gof_comparison.py index 3b63c57d..6f67b1ef 100755 --- a/bbp/utils/misc/plot_gof_comparison.py +++ b/bbp/utils/misc/plot_gof_comparison.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -82,7 +82,7 @@ # Station file a_statfile = os.path.join(a_indir, station_list) slo = StationList(a_statfile) -site_list = slo.getStationList() +site_list = slo.get_station_list() # Capture event_label bias_file = glob.glob("%s%s*.bias" % (a_outdir1, os.sep)) diff --git a/bbp/utils/misc/plot_seismogram_comparison.py b/bbp/utils/misc/plot_seismogram_comparison.py index ae5d644e..66f18344 100755 --- a/bbp/utils/misc/plot_seismogram_comparison.py +++ b/bbp/utils/misc/plot_seismogram_comparison.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2023, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -311,7 +311,7 @@ def main(): params = parse_arguments() slo = StationList(params["station_list"]) - station_list = slo.getStationList() + station_list = slo.get_station_list() for site in station_list: station = site.scode