Skip to content

Commit

Permalink
move base/bases handling out of folder patterns for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
sanahabhimani committed Jan 26, 2024
1 parent c241b1c commit 6739b25
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions python/hk/getdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,28 +866,28 @@ def load_range(start, stop, fields=None, alias=None,
hk_logger.debug(f'Folder {base} does not exist, skipping')
continue

if len(bases) > 1:
hk_logger.warn("More than 1 path exists, please fix") # FIX
bases.sorted()
base = bases[0]
elif len(bases) == 1:
base = bases[0]
elif len(bases) == 0:
hk_logger.warn("No folder path exists.") # FIX; wording obscure

print('base', base)

for file in sorted(os.listdir(base)):
if file.endswith('.yaml'):
continue
try:
t = int(file[:-3])
except:
hk_logger.debug('{} does not have the right format, skipping'.format(file))
continue
if t >= start_ctime-3600 and t <=stop_ctime+3600:
hk_logger.debug('Processing {}'.format(base+'/'+file))
hksc.process_file_with_cache( base+'/'+file)
if len(bases) > 1:
hk_logger.warn("More than 1 path exists, please fix") # FIX
bases.sorted()
base = bases[0]
elif len(bases) == 1:
base = bases[0]
elif len(bases) == 0:
hk_logger.warn("No folder path exists.") # FIX; wording obscure

print('base', base)

for file in sorted(os.listdir(base)):
if file.endswith('.yaml'):
continue
try:
t = int(file[:-3])
except:
hk_logger.debug('{} does not have the right format, skipping'.format(file))
continue
if t >= start_ctime-3600 and t <=stop_ctime+3600:
hk_logger.debug('Processing {}'.format(base+'/'+file))
hksc.process_file_with_cache( base+'/'+file)


cat = hksc.finalize()
Expand Down

0 comments on commit 6739b25

Please sign in to comment.