Skip to content

Commit

Permalink
fix cslc static download filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
scottstanie committed Jul 15, 2024
1 parent 8e982b7 commit 4def6f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/opera_utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,19 @@ def _download_for_burst_ids(
with cm(logger, level=logging.INFO, handler=logging.StreamHandler()):
# Make a tuple so it can be hashed
logger.info(
f"Searching {len(burst_ids)} for {product} (Dates:{start} to {end})"
f"Searching {len(burst_ids)} bursts, {product=} (Dates: {start} to {end})"
)
results = asf.search(
operaBurstID=list(burst_ids),
processingLevel=product.value,
start=start,
end=end,
)
logger.debug(f"Found {len(results)} total results before deduping pgeVersion")
results = filter_results_by_date_and_version(results)
if product == L2Product.CSLC:
logger.debug(
f"Found {len(results)} total results before deduping pgeVersion"
)
results = filter_results_by_date_and_version(results)
logger.info(f"Found {len(results)} results")
session = _get_auth_session()
urls = _get_urls(results)
Expand Down
3 changes: 2 additions & 1 deletion src/opera_utils/stitching.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def merge_images(
logger.info(f"Overwrite=True: removing {outfile}")
Path(outfile).unlink()

is_downsampled = strides is not None and strides["x"] > 1 and strides["y"] > 1
if len(file_list) == 1:
logger.info("Only one image, no stitching needed")
logger.info(f"Copying {file_list[0]} to {outfile} and zeroing nodata values.")
Expand All @@ -106,7 +107,7 @@ def merge_images(
# If not, warp them to the most common projection using VRT files in a tempdir
temp_dir = tempfile.TemporaryDirectory()

if strides is not None and strides["x"] > 1 and strides["y"] > 1:
if is_downsampled:
file_list = get_downsampled_vrts(
file_list,
strides=strides,
Expand Down

0 comments on commit 4def6f3

Please sign in to comment.