Skip to content

Commit 8ae856d

Browse files
EliEli
authored andcommitted
Balance verbosity of logging output.
1 parent d8ab9bc commit 8ae856d

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

dms_datastore/download_cdec.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ def download_station_data(
6161
dest_dir, f"cdec_{station}@{subloc}_{agency_id}_{p}_{yearname}.csv"
6262
).lower()
6363

64+
if freq is None:
65+
dur_codes = ["E", "H"] # new default
66+
else:
67+
dur_codes = [f.strip().upper() for f in freq.split(",") if f.strip()]
68+
6469
result = {
6570
"station": station,
6671
"paramname": p,
@@ -70,7 +75,7 @@ def download_station_data(
7075
"found": False,
7176
"skipped": False,
7277
"reason": None,
73-
"durations_tried": ["E", "H", "D", "M"] if freq is None else [freq],
78+
"durations_tried": dur_codes.copy(),
7479
"sensor_codes_tried": [z],
7580
}
7681

@@ -88,10 +93,7 @@ def download_station_data(
8893
found = False
8994
for code in [z]:
9095

91-
if freq is None:
92-
dur_codes = ["E", "H"] # new default
93-
else:
94-
dur_codes = [f.strip().upper() for f in freq.split(",")]
96+
9597

9698
for dur in dur_codes:
9799
station_query = (

dms_datastore/download_des.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def des_download(stations, dest_dir, start, end=None, param=None, overwrite=Fals
418418
if len(failures) == 0:
419419
logger.info("No failed stations")
420420
else:
421-
logger.info("Failed query stations: ")
421+
logger.info("Failed/unproductive query stations: ")
422422
for failure in failures:
423423
logger.info(failure)
424424

dms_datastore/download_ncro.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ async def _ncro_download_async(stations, dest_dir, stime, etime, overwrite, upda
607607
if os.path.exists(proposed_path) and not overwrite:
608608
logger.info(f"Skipping existing file (use --overwrite to replace): {proposed_path}")
609609
continue
610-
610+
logger.info(f"Scheduling download for station {station_id} site {site} trace {trace} param {paramname}")
611611
task = asyncio.create_task(
612612
_async_download_one_trace_to_csv(
613613
client=client,
@@ -633,7 +633,8 @@ async def _ncro_download_async(stations, dest_dir, stime, etime, overwrite, upda
633633
f"Exception occurred during download: station={station_id} site={site} trace={trace} err={result}"
634634
)
635635
failures.append((station_id, site, trace, str(result)))
636-
636+
else:
637+
logger.debug(f"Successfully downloaded: station={station_id} site={site} trace={trace} path={result}")
637638
return failures
638639

639640

0 commit comments

Comments
 (0)