Skip to content

Commit 7aa5df1

Browse files
committed
fix logging statements in autoscreener
1 parent 9878605 commit 7aa5df1

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

dms_datastore/auto_screen.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ def screener(
4545
plot_dest=None, # directory or 'interactive' or None for no plots
4646
):
4747
"""Performs yaml-specified screening protocol on time series"""
48-
logger.info(f"screening: station_id: {station_id}, subloc: {subloc}, param: {param}")
48+
logger.info(
49+
f"screening: station_id: {station_id}, subloc: {subloc}, param: {param}"
50+
)
4951
# name = protocol['name']
5052
steps = protocol["steps"]
5153
full = None
@@ -54,7 +56,7 @@ def screener(
5456
for step in steps:
5557
method_name = step["method"]
5658
label = step["label"] if "label" in step else method_name
57-
logger.debug("Performing step:", label)
59+
logger.debug(f"Performing step: {label}")
5860
method = globals()[method_name]
5961

6062
args = step["args"]
@@ -241,7 +243,7 @@ def auto_screen(
241243
# logger.debug(f"fetching {fpath},{station_id},{param}")
242244
meta_ts = fetcher(fpath, station_id, param, subloc=subloc)
243245
except:
244-
logger.warning("Read failed for ", fpath, station_id, param, subloc)
246+
logger.warning(f"Read failed for {fpath}, {station_id}, {param}, {subloc}")
245247
meta_ts = None
246248

247249
if meta_ts is None:
@@ -305,7 +307,7 @@ def update_steps(proto, x):
305307
newsteps.append(step)
306308
if len(omissions) > 0:
307309
logger.debug(
308-
"Omissions listed but not found in inherited specification: ", omissions
310+
f"Omissions listed but not found in inherited specification: {omissions}"
309311
)
310312
finalsteps = []
311313
for step in newsteps:
@@ -355,13 +357,13 @@ def context_config(screen_config, station_id, subloc, param):
355357
station_info = station_dbase()
356358

357359
region_file = screen_config["regions"]["region_file"]
358-
logger.debug("Region file: ", region_file)
360+
logger.debug(f"Region file: {region_file}")
359361

360362
if not (os.path.exists(region_file)):
361363
region_file = os.path.join(screen_config["config_dir"], region_file)
362364

363365
# Search for applicable region
364-
logger.debug("station_id: ", station_id, " subloc: ", subloc, " param: ", param)
366+
logger.debug(f"station_id: {station_id}, subloc: {subloc}, param: {param}")
365367
x = station_info.loc[station_id, "x"]
366368
y = station_info.loc[station_id, "y"]
367369
region = spatial_config(region_file, x, y)
@@ -385,9 +387,9 @@ def context_config(screen_config, station_id, subloc, param):
385387
region_config = config["regions"][region_name]
386388
if param in region_config["params"]:
387389
update_region = region_config["params"][param]
388-
logger.debug("region var\n", proto, "\n", update_region)
390+
logger.debug(f"region var\n{proto}\n{update_region}")
389391
proto = update_steps(proto, update_region)
390-
logger.debug("region var 2\n", proto, "\nafter\n", update_region)
392+
logger.debug(f"region var 2\n{proto}\nafter\n{update_region}")
391393

392394
# first priority: match station and variable
393395
station_config = None
@@ -396,9 +398,9 @@ def context_config(screen_config, station_id, subloc, param):
396398
station_config = config["stations"][station_id]
397399
if param in station_config["params"]:
398400
update_station = station_config["params"][param]
399-
logger.debug("station var\n", proto, "\nthen\n", update_station)
401+
logger.debug(f"station var\n{proto}\nthen\n{update_station}")
400402
proto = update_steps(proto, update_station)
401-
logger.debug("station var 2\n", proto, "\nafter\n", update_station)
403+
logger.debug(f"station var 2\n{proto}\nafter\n{update_station}")
402404

403405
return proto
404406

0 commit comments

Comments
 (0)