Skip to content

Commit f1aa23e

Browse files
Merge pull request #71 from asfadmin/test
ARIA Stacking Reference Fix + S1C, NISAR L0B
2 parents 8040298 + fc43c5c commit f1aa23e

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2525
-
2626
2727
-->
28+
------
29+
## [1.0.9](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.8...v1.0.9)
30+
### Fixed
31+
- Fixed bug with ARIA-S1 GUNW stacking over areas without pre-existing ARIA-S1-Frames
32+
33+
### Changed
34+
- bump asf-search to v10.1.2 (Sentinel-1C in ARIA stacking, NISAR L0B science product aliasing)
35+
2836
------
2937
## [1.0.8](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.7...v1.0.8)
3038
### Changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ujson==5.7.0
2222
uvicorn==0.21.1
2323
watchfiles==0.19.0
2424

25-
asf-search[asf-enumeration]==10.1.1
25+
asf-search[asf-enumeration]==10.1.2
2626
python-json-logger==2.0.7
2727

2828
pyshp==2.1.3

src/SearchAPI/application/application.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from copy import copy
12
import json
23

34
import os
@@ -19,6 +20,7 @@
1920
from . import constants
2021
from .SearchAPISession import SearchAPISession
2122
from asf_search.ASFSearchOptions.config import config as asf_config
23+
from asf_enumeration import aria_s1_gunw
2224

2325
asf_config['session'] = SearchAPISession()
2426

@@ -115,18 +117,13 @@ async def query_baseline(searchOptions: BaselineSearchOptsModel = Depends(proces
115117
}
116118
)
117119

118-
# reference_product = None
119120
if is_frame_based and opts.dataset[0] == asf.DATASET.ARIA_S1_GUNW:
120-
try:
121-
reference_product = asf.search(frame=int(reference), opts=opts, maxResults=1)[0]
122-
except (KeyError, IndexError, ValueError) as exc:
123-
raise HTTPException(detail=f"Reference scene not found with frame: {reference}", status_code=400) from exc
121+
return _get_aria_baseline_stack(reference=reference, opts=opts, output=output)
124122

125-
else:
126-
try:
127-
reference_product = asf.granule_search(granule_list=[reference], opts=opts)[0]
128-
except (KeyError, IndexError, ValueError) as exc:
129-
raise HTTPException(detail=f"Reference scene not found: {reference}", status_code=400) from exc
123+
try:
124+
reference_product = asf.granule_search(granule_list=[reference], opts=opts)[0]
125+
except (KeyError, IndexError, ValueError) as exc:
126+
raise HTTPException(detail=f"Reference scene not found: {reference}", status_code=400) from exc
130127

131128
try:
132129
if reference_product.get_stack_opts() is None:
@@ -270,6 +267,23 @@ def validate_wkt(wkt: str):
270267
'repairs': repairs
271268
}
272269

270+
def _get_aria_baseline_stack(reference: str, opts: asf.ASFSearchOptions, output: str):
271+
if output.lower() == 'count':
272+
stack_opts = asf.Products.ARIAS1GUNWProduct.get_stack_opts_for_frame(int(reference), opts=opts)
273+
count=asf.search_count(opts=stack_opts)
274+
return Response(
275+
content=str(count),
276+
status_code=200,
277+
media_type='text/html; charset=utf-8',
278+
headers=constants.DEFAULT_HEADERS
279+
)
280+
try:
281+
stack = asf.stack_from_id(reference, opts=opts)
282+
response_info = as_output(stack, output)
283+
return Response(**response_info)
284+
except (KeyError, IndexError, ValueError) as exc:
285+
raise HTTPException(detail=f"Reference scene not found with frame: {reference}", status_code=400) from exc
286+
273287

274288
@router.get('/', response_class=JSONResponse)
275289
@router.get('/health', response_class=JSONResponse)

0 commit comments

Comments
 (0)