Skip to content

Commit

Permalink
Renamed methods in StationList class to follow pep 8 style guide.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiolsilva committed Sep 27, 2023
1 parent a8dc48e commit b8f8a40
Show file tree
Hide file tree
Showing 60 changed files with 210 additions and 206 deletions.
6 changes: 3 additions & 3 deletions bbp/comps/anderson_gof.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 = []
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/as16.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions bbp/comps/bbtoolbox.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/bbtoolbox_correlation.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/calculate_gmpe.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/cc.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/copy_seismograms.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/correct_psa.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions bbp/comps/csm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand All @@ -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()
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions bbp/comps/exsim.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -381,7 +381,7 @@ def create_exsim_param_file(self):
self.template_replace(["<END_OF_TEMPLATE_FILE>"], [""])

# 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:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/fas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/fas_gof.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/gen_plots.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/genhtml.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/geobb_srf.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 = []
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/gmpe_comparison.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/gmpe_plot.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions bbp/comps/gp_gof.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit b8f8a40

Please sign in to comment.