Skip to content

Commit

Permalink
Handle some edge cases and log warnings and errors only (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpreimes authored Nov 4, 2024
1 parent ab83dbc commit b2e124d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/repurpose/img2ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,15 +695,19 @@ def calc(self):
if self.global_attr is None:
self.global_attr = {}

self.global_attr['time_coverage_end'] = str(timestamps[-1])
try:
self.global_attr['time_coverage_end'] = str(timestamps[-1])
except IndexError: # this can be the case if a whole bulk is empty
warnings.warn("Could not infer time coverage from files")
self.global_attr['time_coverage_end'] = "unknown"

parallel_process(
FUNC=FUNC,
ITER_KWARGS=ITER_KWARGS,
STATIC_KWARGS=STATIC_KWARGS,
log_path=os.path.join(self.outputpath, '000_log'),
log_filename=self.log_filename,
loglevel="INFO",
loglevel="WARNING",
logger_name='img2ts',
ignore_errors=self.ignore_errors,
n_proc=self.n_proc,
Expand Down Expand Up @@ -777,7 +781,7 @@ def img_bulk(self):
img_dict = {}
timestamps = np.array([])

while len(results) > 0:
while (results is not None) and len(results) > 0:
img, orthogonal = results.pop(0)

for k, v in img.data.items():
Expand Down

0 comments on commit b2e124d

Please sign in to comment.