Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ 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

### 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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 24 additions & 10 deletions src/SearchAPI/application/application.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from copy import copy
import json

import os
Expand All @@ -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()

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -270,6 +267,23 @@ 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.Products.ARIAS1GUNWProduct.get_stack_opts_for_frame(int(reference), opts=opts)
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)
Expand Down
Loading