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
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
------
## [1.0.8](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.7...v1.0.8)
### Changed
- bump asf-search to v10.0.1 for NISAR `GUNW` and `GSLC` `processingLevel` search keyword collection aliases, and ARIA-S1 GUNW Stacking support
- also adds NISAR file size export support
- bump asf-search to v10.0.2 for NISAR product type file sizes, urgent response now searchable with product types, and ARIA-S1 GUNW Stacking support

### Fixed
- boolean values are properly capitalized in `python` output file

------
## [1.0.7](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.6...v1.0.7)
### 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.0.1
asf-search[asf-enumeration]==10.0.2
python-json-logger==2.0.7

pyshp==2.1.3
Expand Down
28 changes: 27 additions & 1 deletion src/SearchAPI/application/application.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import json

import os
Expand All @@ -6,7 +7,7 @@

import asf_search as asf
from fastapi import Depends, FastAPI, Request, HTTPException, APIRouter, UploadFile
from fastapi.responses import Response, JSONResponse
from fastapi.responses import RedirectResponse, Response, JSONResponse
from fastapi.middleware.cors import CORSMiddleware

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

# @router.get('/redirect/{shortName}')
# async def nisar_static_layer(shortName: str, granule_id: str, cmr_token: Optional[str], cmr_host: Optional[str]='uat'):
# opts = asf.ASFSearchOptions()
# if cmr_token is not None:
# if cmr_host == 'uat':
# host = asf.INTERNAL.CMR_HOST_UAT
# else:
# host = asf.INTERNAL.CMR_HOST
# session = asf.ASFSession(cmr_host=host).auth_with_token(cmr_token)
# opts.session = session
# opts.host = host
# try:
# granule = asf.search(
# granule_list=[granule_id],
# opts=opts
# )[0]
# except IndexError:
# raise HTTPException(status_code=400, detail=f'Unable to find static layer, provided scene named "{granule_id}" not found in CMR record')

# static_layer = granule.get_static_layer(opts=asf.ASFSearchOptions(shortName=shortName))
# if static_layer is None:
# raise HTTPException(status_code=500, detail=f'Static layer not found for scene named "{granule_id}"')

# return RedirectResponse(static_layer.properties['url'])


def validate_wkt(wkt: str):
try:
Expand Down
6 changes: 4 additions & 2 deletions src/SearchAPI/application/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,14 @@ def get_asf_search_script(
) -> tuple[str, str]:

opts.session = None
# ASFSearchOptions formatting uses json.dumps for serialization. Add proper python capitalization
opts_str = str(opts).replace('true', 'True', -1).replace('false', 'False')
if search_endpoint == 'param':
file_name=make_filename('py', prefix='asf-search-script')
output_script = asf_search_script_template.format(file_name, str(opts))
output_script = asf_search_script_template.format(file_name, opts_str)
else:
file_name=make_filename('py', prefix='asf-search-baseline-script')
output_script = asf_search_baseline_script_template.format(file_name, reference, str(opts))
output_script = asf_search_baseline_script_template.format(file_name, reference, opts_str)
return file_name, output_script

def make_filename(suffix, prefix:str = 'asf-results'):
Expand Down