Skip to content

Commit 2b43f2f

Browse files
authored
s1_orbit.py: if autodownloading, create the directory (#100)
* s1_orbit.py: if autodownloading, create the directory There shouldnt be a need to have the user `mkdir -p orbits/` if they have already specified they do not have the orbits and want to download them. * add print to log directory creation
1 parent 428328d commit 2b43f2f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/s1reader/s1_orbit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,11 @@ def get_orbit_file_from_dir(zip_path: str, orbit_dir: str, auto_download: bool =
246246
raise FileNotFoundError(f"{zip_path} does not exist")
247247

248248
if not os.path.isdir(orbit_dir):
249-
raise NotADirectoryError(f"{orbit_dir} not found")
249+
if not auto_download:
250+
raise NotADirectoryError(f"{orbit_dir} not found")
251+
else:
252+
print(f"{orbit_dir} not found, creating directory.")
253+
os.makedirs(orbit_dir, exist_ok=True)
250254

251255
# extract platform id, start and end times from swath file name
252256
platform_id, t_swath_start_stop = get_file_name_tokens(zip_path)

0 commit comments

Comments
 (0)