Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/multithread-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
MDavidson17 committed Aug 2, 2023
2 parents 770341c + 5e697cb commit 177f8a8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/standardising.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ def download_tiff_and_sidecar(target: str, file: str) -> str:
download_path = os.path.join(target, f"{ulid.ULID()}.tiff")
get_log().info("Download File Called", path=file, target_path=download_path)
write(download_path, read(file))
# for ext in [".prj", ".tfw"]:
# try:
# write(f"{target.split('.')[0]}{ext}", read(f"{file.split('.')[0]}{ext}"))
# get_log().info(
# "download_tiff_sidecar", path=f"{file.split('.')[0]}{ext}", target_path=f"{target.split('.')[0]}{ext}"
# )
# except: # pylint: disable-msg=bare-except
# pass
for ext in [".prj", ".tfw"]:
try:
write(f"{target.split('.')[0]}{ext}", read(f"{file.split('.')[0]}{ext}"))
get_log().info(
"download_tiff_sidecar", path=f"{file.split('.')[0]}{ext}", target_path=f"{target.split('.')[0]}{ext}"
)
except: # pylint: disable-msg=bare-except
pass
return download_path


Expand Down Expand Up @@ -176,10 +176,12 @@ def standardising(
return tiff

# Download any needed file from S3 ["/foo/bar.tiff", "s3://foo"] => "/tmp/bar.tiff", "/tmp/foo.tiff"
# tmp_path = tempfile.mkdtemp()
with tempfile.TemporaryDirectory() as tmp_path:
standardized_working_path = os.path.join(tmp_path, standardized_file_name)
source_tiffs = download_files_multithreaded(files.input, tmp_path)
if len(source_tiffs) != len(files.input):
get_log().error("Missing Files", missing_file_count=len(files.input) - len(source_tiffs))
raise Exception("Not all source files were downloaded")

vrt_add_alpha = True

Expand Down

0 comments on commit 177f8a8

Please sign in to comment.