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.11](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.10...v1.0.11)
### Changed
- bump asf-search to v11.0.1
- NISAR CRID field
- NISAR track number searchable with relativeOrbit, parsed from UMM
- remove `nisar_stuf` collection from NISAR dataset collections list (further removals pending)

------
## [1.0.10](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.9...v1.0.10)
### 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.2.0
asf-search[asf-enumeration]==11.0.1
python-json-logger==2.0.7

pyshp==2.1.3
Expand Down
26 changes: 26 additions & 0 deletions src/SearchAPI/application/application.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from copy import copy
import json

Expand Down Expand Up @@ -226,6 +227,31 @@ async def file_to_wkt(files: list[UploadFile]):
headers=constants.DEFAULT_HEADERS
)

@router.get('/services/utils/kml_footprint')
async def kml_to_footprint(granule: str, cmr_token: Optional[str] = None, maturity: str = 'prod'):
config = load_config_maturity(maturity=maturity)

query_opts = asf.ASFSearchOptions(granule_list=[granule])
if (cmr_token) is not None:
session = SearchAPISession()
session.headers.update({'Authorization': f'Bearer {cmr_token}'})
query_opts.session = session


query_opts.host = config['cmr_base']

results = asf.search(opts=query_opts, dataset=asf.DATASET.NISAR)

kml_file = results.find_urls(extension='.kml')[0]

kml_response = query_opts.session.get(kml_file)
return Response(
content=str(kml_response.text),
status_code=200,
media_type='text/html; charset=utf-8',
headers=constants.DEFAULT_HEADERS
)

# example: https://api.daac.asf.alaska.edu/services/redirect/NISAR_L2_STATIC/{granule_id}.h5
# @router.get('/services/redirect/{short_name}/{granule_id}')
# async def nisar_static_layer(short_name: str, granule_id: str):
Expand Down
20 changes: 7 additions & 13 deletions tests/yml_tests/test_URLs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ tests:
expected file: csv
expected code: 200

- beamSwath STD SS 100:
beamSwath: STD
platform: SEASAT
- beamMode STD SS 100:
beamMode: STD
platform: "SEASAT 1"
maxresults: 100
output: csv

Expand Down Expand Up @@ -470,7 +470,7 @@ tests:
groupid: S1-GUNW-D-R-087-tops-20190816_20190804-161614-19149N_17138N-PP-fee7-v2_0_2
output: json

expected file: json
expected file: blank json
expected code: 200

- groupid SMAP:
Expand Down Expand Up @@ -2042,15 +2042,6 @@ tests:
expected file: csv
expected code: 200

- processingLevel SEASAT:
processingLevel: L1,BROWSE,THUMBNAIL
platform: SEASAT
maxResults: 10
output: csv

expected file: csv
expected code: 200

- processingLevel S1:
processingLevel: METADATA_GRD,GRD_HS,GRD_HD,GRD_MS,GRD_MD,GRD_FS,GRD_FD,SLC,RAW,OCN,METADATA_RAW,METADATA,METADATA_SLC, THUMBNAIL
platform: Sentinel-1A,Sentinel-1B
Expand Down Expand Up @@ -2400,6 +2391,7 @@ tests:
- start end 6monthago:
start: 6+month+ago
end: now
dataset: SENTINEL-1
maxResults: 10
output: csv

Expand Down Expand Up @@ -2438,6 +2430,7 @@ tests:
- start backwards reversed:
start: now
end: 1+year+ago
dataset: SENTINEL-1
output: csv
maxResults: 10

Expand All @@ -2447,6 +2440,7 @@ tests:
- start tomorrow reversed:
start: tomorrow
end: 1+year+ago
dataset: SENTINEL-1
output: csv
maxResults: 10

Expand Down
Loading