Skip to content

Commit

Permalink
s1_reader: fix safe_path for directories (#91)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
scottstanie authored Dec 7, 2022
1 parent a9c20a4 commit ae88a1d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/s1reader/s1_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,10 +876,8 @@ def _burst_from_safe_dir(safe_dir_path: str, id_str: str, orbit_path: str, flag_

# find tiff file if measurement directory found
if os.path.isdir(f'{safe_dir_path}/measurement'):
measurement_list = os.listdir(f'{safe_dir_path}/measurement')
f_tiff = [f for f in measurement_list
if 'measurement' in f and id_str in f and 'tiff' in f]
f_tiff = f'{safe_dir_path}/measurement/{f_tiff[0]}' if f_tiff else ''
f_tiff = glob.glob(f'{safe_dir_path}/measurement/*{id_str}*tiff')
f_tiff = f_tiff[0] if f_tiff else ''
else:
msg = f'measurement directory NOT found in {safe_dir_path}'
msg += ', continue with metadata only.'
Expand Down

0 comments on commit ae88a1d

Please sign in to comment.