From 36d9949fa1c17a1fa0c597839e39dd6d7d3c6e98 Mon Sep 17 00:00:00 2001 From: SpicyGarlicAlbacoreRoll Date: Wed, 22 Oct 2025 17:18:55 -0800 Subject: [PATCH 1/3] bug (wip): fix aria s1 gunw stacking over area without existing aria product --- CHANGELOG.md | 5 +++ src/SearchAPI/application/application.py | 44 ++++++++++++++++++------ 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3670a95..e43b20f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,11 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - --> +------ +## [1.0.9](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.8...v1.0.9) +### Fixed +- Fixed bug with ARIA-S1 GUNW stacking over areas without pre-existing ARIA-S1-Frames + ------ ## [1.0.8](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.7...v1.0.8) ### Changed diff --git a/src/SearchAPI/application/application.py b/src/SearchAPI/application/application.py index 825924d..bffe400 100644 --- a/src/SearchAPI/application/application.py +++ b/src/SearchAPI/application/application.py @@ -1,3 +1,4 @@ +from copy import copy import json import os @@ -19,6 +20,7 @@ from . import constants from .SearchAPISession import SearchAPISession from asf_search.ASFSearchOptions.config import config as asf_config +from asf_enumeration import aria_s1_gunw asf_config['session'] = SearchAPISession() @@ -115,18 +117,13 @@ async def query_baseline(searchOptions: BaselineSearchOptsModel = Depends(proces } ) - # reference_product = None if is_frame_based and opts.dataset[0] == asf.DATASET.ARIA_S1_GUNW: - try: - reference_product = asf.search(frame=int(reference), opts=opts, maxResults=1)[0] - except (KeyError, IndexError, ValueError) as exc: - raise HTTPException(detail=f"Reference scene not found with frame: {reference}", status_code=400) from exc + return _get_aria_baseline_stack(reference=reference, opts=opts, output=output) - else: - try: - reference_product = asf.granule_search(granule_list=[reference], opts=opts)[0] - except (KeyError, IndexError, ValueError) as exc: - raise HTTPException(detail=f"Reference scene not found: {reference}", status_code=400) from exc + try: + reference_product = asf.granule_search(granule_list=[reference], opts=opts)[0] + except (KeyError, IndexError, ValueError) as exc: + raise HTTPException(detail=f"Reference scene not found: {reference}", status_code=400) from exc try: if reference_product.get_stack_opts() is None: @@ -270,6 +267,33 @@ def validate_wkt(wkt: str): 'repairs': repairs } +def _get_aria_baseline_stack(reference: str, opts: asf.ASFSearchOptions, output: str): + if output.lower == 'count': + stack_opts = asf.ASFSearchOptions() if opts is None else copy(opts) + aria_frame = aria_s1_gunw.get_frame(int(reference)) + stack_opts.dataset = asf.DATASET.SENTINEL1 + stack_opts.platform = ['SA', 'SB', 'SC'] + stack_opts.processingLevel = asf.PRODUCT_TYPE.SLC + stack_opts.beamMode = asf.BEAMMODE.IW + stack_opts.polarization = [asf.POLARIZATION.VV, asf.POLARIZATION.VV_VH] + stack_opts.flightDirection = aria_frame.flight_direction + stack_opts.relativeOrbit = aria_frame.path + stack_opts.intersectsWith = aria_frame.wkt + + count=asf.search_count(opts=stack_opts) + return Response( + content=str(count), + status_code=200, + media_type='text/html; charset=utf-8', + headers=constants.DEFAULT_HEADERS + ) + try: + stack = asf.stack_from_id(reference, opts=opts) + response_info = as_output(stack, output) + return Response(**response_info) + except (KeyError, IndexError, ValueError) as exc: + raise HTTPException(detail=f"Reference scene not found with frame: {reference}", status_code=400) from exc + @router.get('/', response_class=JSONResponse) @router.get('/health', response_class=JSONResponse) From 5942e78a0c400a598185065c0ea65f484c653df7 Mon Sep 17 00:00:00 2001 From: SpicyGarlicAlbacoreRoll Date: Thu, 23 Oct 2025 08:44:11 -0800 Subject: [PATCH 2/3] style: update with cleaner solution from latest asf-search version --- requirements.txt | 2 +- src/SearchAPI/application/application.py | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/requirements.txt b/requirements.txt index de9c4c4..7352056 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ ujson==5.7.0 uvicorn==0.21.1 watchfiles==0.19.0 -asf-search[asf-enumeration]==10.1.1 +asf-search[asf-enumeration]==10.1.2 python-json-logger==2.0.7 pyshp==2.1.3 diff --git a/src/SearchAPI/application/application.py b/src/SearchAPI/application/application.py index bffe400..a29fbac 100644 --- a/src/SearchAPI/application/application.py +++ b/src/SearchAPI/application/application.py @@ -268,18 +268,8 @@ def validate_wkt(wkt: str): } def _get_aria_baseline_stack(reference: str, opts: asf.ASFSearchOptions, output: str): - if output.lower == 'count': - stack_opts = asf.ASFSearchOptions() if opts is None else copy(opts) - aria_frame = aria_s1_gunw.get_frame(int(reference)) - stack_opts.dataset = asf.DATASET.SENTINEL1 - stack_opts.platform = ['SA', 'SB', 'SC'] - stack_opts.processingLevel = asf.PRODUCT_TYPE.SLC - stack_opts.beamMode = asf.BEAMMODE.IW - stack_opts.polarization = [asf.POLARIZATION.VV, asf.POLARIZATION.VV_VH] - stack_opts.flightDirection = aria_frame.flight_direction - stack_opts.relativeOrbit = aria_frame.path - stack_opts.intersectsWith = aria_frame.wkt - + if output.lower() == 'count': + stack_opts = asf.Products.ARIAS1GUNWProduct.get_stack_opts_for_frame(int(reference), opts=opts) count=asf.search_count(opts=stack_opts) return Response( content=str(count), From 31ca48a80171a2738a14dbb5cd4e69654f1f1b94 Mon Sep 17 00:00:00 2001 From: Kim <33294735+SpicyGarlicAlbacoreRoll@users.noreply.github.com> Date: Thu, 23 Oct 2025 09:00:51 -0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e43b20f..5920a8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Fixed - Fixed bug with ARIA-S1 GUNW stacking over areas without pre-existing ARIA-S1-Frames +### Changed +- bump asf-search to v10.1.2 (Sentinel-1C in ARIA stacking, NISAR L0B science product aliasing) + ------ ## [1.0.8](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.7...v1.0.8) ### Changed