Skip to content

Commit ae88a1d

Browse files
authored
s1_reader: fix safe_path for directories (#91)
* s1_reader: fix safe_path for directories _burst_from_safe_dir used os.listdir, which does not have "measurement" in the returned names like the zip file list does this fixes #90 * return a string instead of list
1 parent a9c20a4 commit ae88a1d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/s1reader/s1_reader.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,8 @@ def _burst_from_safe_dir(safe_dir_path: str, id_str: str, orbit_path: str, flag_
876876

877877
# find tiff file if measurement directory found
878878
if os.path.isdir(f'{safe_dir_path}/measurement'):
879-
measurement_list = os.listdir(f'{safe_dir_path}/measurement')
880-
f_tiff = [f for f in measurement_list
881-
if 'measurement' in f and id_str in f and 'tiff' in f]
882-
f_tiff = f'{safe_dir_path}/measurement/{f_tiff[0]}' if f_tiff else ''
879+
f_tiff = glob.glob(f'{safe_dir_path}/measurement/*{id_str}*tiff')
880+
f_tiff = f_tiff[0] if f_tiff else ''
883881
else:
884882
msg = f'measurement directory NOT found in {safe_dir_path}'
885883
msg += ', continue with metadata only.'

0 commit comments

Comments
 (0)