From fa98df6879f1668a142ba24ef63e80147b999ce6 Mon Sep 17 00:00:00 2001 From: SpicyGarlicAlbacoreRoll Date: Thu, 14 Aug 2025 13:12:51 -0800 Subject: [PATCH 1/3] wip: added nisar static layer endpoint (commented out until method added to asf-search) --- src/SearchAPI/application/application.py | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/SearchAPI/application/application.py b/src/SearchAPI/application/application.py index c95e6d6..2e88347 100644 --- a/src/SearchAPI/application/application.py +++ b/src/SearchAPI/application/application.py @@ -1,3 +1,4 @@ +from datetime import datetime import json import os @@ -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 @@ -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: From 6ae631fa063ace70783983b17af08c6947602262 Mon Sep 17 00:00:00 2001 From: SpicyGarlicAlbacoreRoll Date: Wed, 27 Aug 2025 16:14:33 -0800 Subject: [PATCH 2/3] fix: booleans in `python` output capitalized --- CHANGELOG.md | 3 +++ src/SearchAPI/application/output.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54ee354..72291de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed - bump asf-search to v10.0.0 for NISAR `GUNW` and `GSLC` `processingLevel` search keyword collection aliases, 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 diff --git a/src/SearchAPI/application/output.py b/src/SearchAPI/application/output.py index 37d3c39..fdd6b3b 100644 --- a/src/SearchAPI/application/output.py +++ b/src/SearchAPI/application/output.py @@ -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'): From db6a7fc72e3dd3136ef68962968d3061f2cf1844 Mon Sep 17 00:00:00 2001 From: SpicyGarlicAlbacoreRoll Date: Thu, 28 Aug 2025 09:14:05 -0800 Subject: [PATCH 3/3] update changelog and requirements.txt --- CHANGELOG.md | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72291de..3ba673f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ 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.0 for NISAR `GUNW` and `GSLC` `processingLevel` search keyword collection aliases, and ARIA-S1 GUNW Stacking 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 diff --git a/requirements.txt b/requirements.txt index 85fc44d..277371a 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.0.0 +asf-search[asf-enumeration]==10.0.2 python-json-logger==2.0.7 pyshp==2.1.3