Skip to content

Commit 38ce1ac

Browse files
committed
slightly more sensible variable name
1 parent 15855ab commit 38ce1ac

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

build-db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def builddb(infile, check_originator_flag_type = True,
164164

165165
query = "INSERT INTO " + dbtable + " (raw, truth, uid, year, month, day, time, lat, long, country, cruise, ocruise, probe, flagged) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?);"
166166
values = (p['raw'], p['truth'], p['uid'], p['year'], p['month'], p['day'], p['time'], p['latitude'], p['longitude'], country, p['cruise'], orig_cruise, p['probe_type'], int(flagged))
167-
main.dbinteract(query, values, inputdb=outfile)
167+
main.dbinteract(query, values, targetdb=outfile)
168168
if profile.is_last_profile_in_file(fid) == True:
169169
break
170170

plot-roc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def plotRow(row):
7878
pylab.savefig(dir + str(p.uid()) + '.png', bbox_inches='tight')
7979
plt.close()
8080

81-
def plot_roc(inputdb='iquod.db'):
81+
def plot_roc(targetdb='iquod.db'):
8282

8383
# get qc tests
8484
testNames = main.importQC('qctests')
8585

8686
# connect to database
87-
conn = sqlite3.connect(inputdb, isolation_level=None)
87+
conn = sqlite3.connect(targetdb, isolation_level=None)
8888
cur = conn.cursor()
8989

9090
# extract matrix of test results and true flags into a dataframe

util/dbutils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ def db_to_df(table,
8484
filter_on_wire_break_test=False,
8585
filter_on_tests={},
8686
n_to_extract=numpy.iinfo(numpy.int32).max,
87-
inputdb='iquod.db'):
87+
targetdb='iquod.db'):
8888

8989
'''
90-
Reads the table from inputdb into a pandas dataframe.
90+
Reads the table from targetdb into a pandas dataframe.
9191
If filter_on_wire_break_test is True, the results from that test are used to exclude
9292
levels below a wire break from the test results and the wire break test is not returned.
9393
filter_on_tests is a generalised form of filter_on_wire_break and is used to exclude results; it takes a list of
@@ -100,7 +100,7 @@ def db_to_df(table,
100100
testNames.sort()
101101

102102
# connect to database
103-
conn = sqlite3.connect(inputdb, isolation_level=None)
103+
conn = sqlite3.connect(targetdb, isolation_level=None)
104104
cur = conn.cursor()
105105

106106
# extract matrix of test results and true flags into a dataframe

util/main.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ def dictify(rows, keys):
167167

168168
return dicts
169169

170-
def dbinteract(command, values=[], tries=0, inputdb='iquod.db'):
170+
def dbinteract(command, values=[], tries=0, targetdb='iquod.db'):
171171
'''
172172
execute the given SQL command;
173173
catch errors and retry a maximum number of times;
174174
'''
175175

176176
max_retry = 100
177177

178-
conn = sqlite3.connect(inputdb, isolation_level=None, timeout=60)
178+
conn = sqlite3.connect(targetdb, isolation_level=None, timeout=60)
179179
cur = conn.cursor()
180180

181181
try:
@@ -201,13 +201,13 @@ def dbinteract(command, values=[], tries=0, inputdb='iquod.db'):
201201
print('database interaction failed after', max_retry, 'retries')
202202
return -1
203203

204-
def interact_many(query, values, tries=0, inputdb='iquod.db'):
204+
def interact_many(query, values, tries=0, targetdb='iquod.db'):
205205
# similar to dbinteract, but does executemany
206206
# intended exclusively for writes
207207

208208
max_retry = 100
209209

210-
conn = sqlite3.connect(inputdb, isolation_level=None, timeout=60)
210+
conn = sqlite3.connect(targetdb, isolation_level=None, timeout=60)
211211
cur = conn.cursor()
212212

213213
try:

0 commit comments

Comments
 (0)