Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cs.v3 test suite #739

Draft
wants to merge 83 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c548d41
Merge pull request #596 from asfadmin/test
Cameronsplaze Mar 8, 2022
d953398
Merge pull request #626 from asfadmin/test
Cameronsplaze Mar 29, 2022
77bf8c3
Merge pull request #631 from asfadmin/test
glshort Apr 6, 2022
f399e16
Merge pull request #634 from asfadmin/test
SpicyGarlicAlbacoreRoll May 2, 2022
7a5677c
Merge pull request #637 from asfadmin/test
glshort May 6, 2022
4e30eac
Merge pull request #640 from asfadmin/test
SpicyGarlicAlbacoreRoll May 24, 2022
5925a4f
Merge pull request #644 from asfadmin/test
SpicyGarlicAlbacoreRoll Aug 11, 2022
9f3935e
Merge pull request #648 from asfadmin/test
Cameronsplaze Sep 8, 2022
8e12741
Merge pull request #682 from asfadmin/test
SpicyGarlicAlbacoreRoll Feb 14, 2023
738e2ce
Merge pull request #686 from asfadmin/test
SpicyGarlicAlbacoreRoll Feb 23, 2023
4ec7e28
Merge pull request #688 from asfadmin/test
Cameronsplaze Mar 23, 2023
edff102
Merge pull request #697 from asfadmin/test
SpicyGarlicAlbacoreRoll Mar 30, 2023
455a568
Merge pull request #699 from asfadmin/test
SpicyGarlicAlbacoreRoll Apr 5, 2023
613deb5
Merge pull request #701 from asfadmin/test
SpicyGarlicAlbacoreRoll Apr 11, 2023
bda8b27
Merge pull request #708 from asfadmin/test
Cameronsplaze May 8, 2023
558862e
Merge pull request #714 from asfadmin/test
Cameronsplaze May 8, 2023
ce4f5f2
baseline endpoint no longer builds entire stack when querying count e…
Jul 8, 2023
77a3b92
code factor fix
Jul 10, 2023
30ed01a
changes "build_stack_params" to "build_stack_query"
Jul 10, 2023
1ccac58
Using this suite, to help validate v3 API. Updating tests that we dee…
Cameronsplaze Aug 14, 2023
9383edb
Changed all 'polygon' keys to a intersectsWith: polygon((*))
Cameronsplaze Aug 24, 2023
0844685
removes burst map products from S1 dataset entry
Nov 2, 2023
732048b
adds RTC/CSLC-STATIC concept ids to opera dataset collections
Nov 3, 2023
d00fb34
adds error handling when provided invalid dataset
Nov 6, 2023
fde4e6a
comments out log_subquery_time for now, adds opera calval concept-ids…
Nov 8, 2023
a63164b
adds missing dataset collections check for should_use_asf_frame() method
Nov 8, 2023
e1ec96b
changes 'datasets' keyword to 'dataset'
Nov 8, 2023
10b478e
adds calval products to opera s1 dataset
Nov 29, 2023
f12f444
Merge pull request #731 from asfadmin/burst-calval
SpicyGarlicAlbacoreRoll Nov 29, 2023
d4d1b4e
adds validity start date for static opera product types
Dec 5, 2023
bd5b2ec
fixes capitalization
Dec 5, 2023
c4c0e5d
checks if providerbrowseUrls available
Dec 5, 2023
4cb0ab8
Merge branch 'test' into opera-static-validityStartDate
SpicyGarlicAlbacoreRoll Dec 5, 2023
110619e
Merge pull request #733 from asfadmin/opera-static-validityStartDate
tylercchase Dec 5, 2023
9496a43
moves opera calibration collections into separate "calibration" datasets
Jan 23, 2024
e242de7
Merge branch 'test' into topic-opera-s1-calibration-dataset
SpicyGarlicAlbacoreRoll Jan 23, 2024
a2438b3
Update datasets.py
SpicyGarlicAlbacoreRoll Jan 23, 2024
809d1ff
removes static OPERA-S1 calibration dataset
Jan 24, 2024
e766bca
Merge branch 'topic-opera-s1-calibration-dataset' of https://github.c…
Jan 24, 2024
085f128
changes SB test case to fixed time span
Jan 24, 2024
a01d834
changes test case date range
Jan 25, 2024
99e3b94
Merge pull request #735 from asfadmin/topic-opera-s1-calibration-dataset
SpicyGarlicAlbacoreRoll Jan 25, 2024
af6ae15
style: OPERA calibration -> calval
Feb 1, 2024
8818e24
Merge pull request #737 from asfadmin/topic-opera-calval
SpicyGarlicAlbacoreRoll Feb 1, 2024
6f99356
all baseline tests passing
Feb 27, 2024
c1a5038
json tests now expect jsonlite, asf-search output format tests removed
Feb 28, 2024
dbed677
Merge branch 'test' into cs.v3-test-suite
Feb 28, 2024
f96dbaf
adds empty nisar dataset
Feb 28, 2024
2ff40bf
adds nisar uat dataset concept-ids
Feb 28, 2024
93af966
adds check for gpolygon, returns empty wkt if no gpolygon is parsed
Feb 28, 2024
cec053e
comments out non-spatial collections, adds commented out spatial coll…
Feb 28, 2024
90641cb
adds latest nisar collections
Feb 28, 2024
3a24206
Merge pull request #741 from asfadmin/nisar-dataset
SpicyGarlicAlbacoreRoll Feb 28, 2024
c7c6751
Merge branch 'test' into cs.v3-test-suite
Feb 29, 2024
fca2f06
update some test logic, removes polygon closure test
Mar 5, 2024
02bfd9f
udpate test case
Mar 6, 2024
2a214fc
corrects nisar concept-id list
Mar 6, 2024
5563a7e
Merge pull request #743 from asfadmin/bugfix-nisar-bpv-collections
SpicyGarlicAlbacoreRoll Mar 6, 2024
ca362b7
Merge branch 'test' into cs.v3-test-suite
Mar 6, 2024
1641d82
update test suite
Mar 9, 2024
2cc0e21
adds shortname search keyword support
Mar 21, 2024
d01ea13
checks length of absolute orbit before assignment in geojson output. …
Mar 22, 2024
35f45fc
Merge pull request #745 from asfadmin/nisar-fixes
SpicyGarlicAlbacoreRoll Mar 22, 2024
e520313
shortname will dodge the subquery system
Mar 22, 2024
0e32a0f
adds s3urls to jsonlite and jsonlite2 endpoints
Mar 27, 2024
ba3bd35
reveals s3urls and additionalUrls for nisar products
Apr 1, 2024
5664c24
Merge pull request #747 from asfadmin/feature-s3-urls
SpicyGarlicAlbacoreRoll Apr 1, 2024
61f9112
refactors some url parsing logic
Apr 2, 2024
dc114d9
Merge pull request #749 from asfadmin/feature-s3-urls
SpicyGarlicAlbacoreRoll Apr 2, 2024
3650169
Merge branch 'test' into cs.v3-test-suite
Apr 2, 2024
9e0ae5f
update content type to expect appropriate mime type for geojson (geo+…
Apr 3, 2024
8eb22d2
adds comments for two test_know_bugs categories
Apr 9, 2024
15653f8
update test case to work with list in csv cell for gunw product absol…
Apr 9, 2024
22d7c1a
use ciso8601 for date parsing in baseline calculations
Apr 22, 2024
0fc2567
update requirements.txt, updates yesterday test to check pst three da…
Apr 24, 2024
8ef3191
removes deprecated sklearn dependency, upgrades pytest-automation, wk…
Apr 24, 2024
e7cec05
Merge pull request #751 from asfadmin/topic-update-requirements
SpicyGarlicAlbacoreRoll Apr 24, 2024
d6c69c0
Merge branch 'test' into topic-baseline-speedup
SpicyGarlicAlbacoreRoll Apr 24, 2024
e2cdac4
Merge pull request #750 from asfadmin/topic-baseline-speedup
SpicyGarlicAlbacoreRoll Apr 24, 2024
53abc41
fixes missing bracket in geojson output
Apr 25, 2024
88be871
Merge pull request #752 from asfadmin/hotfix-geojson-spec
SpicyGarlicAlbacoreRoll Apr 25, 2024
9f6fa28
Merge branch 'test' into cs.v3-test-suite
May 6, 2024
70eba65
absoluteOrbit list check in csv works
May 6, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/reusable-DeployStack-SearchAPI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
python3 -m pip install --no-cache-dir --upgrade pip
python3 -m pip install --no-cache-dir wheel Cython
python3 -m pip install -r requirements.txt --use-deprecated=legacy-resolver
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ WORKDIR "${LAMBDA_TASK_ROOT}/Discovery-SearchAPI"
COPY requirements.txt .
RUN mkdir "${LAMBDA_TASK_ROOT}/python-packages"
ENV PYTHONPATH "${PYTHONPATH}:${LAMBDA_TASK_ROOT}/python-packages"
ENV SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
RUN python3 -m pip install --no-cache-dir -r requirements.txt --target "${LAMBDA_TASK_ROOT}/python-packages"

## Copy required files (Already inside Discovery-SearchAPI dir):
Expand Down
13 changes: 6 additions & 7 deletions SearchAPI/Baseline/Calc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from math import sqrt, cos, sin, radians
import numpy as np
import dateparser

import ciso8601
# WGS84 constants
a = 6378137
f = pow((1.0 - 1 / 298.257224), 2)
Expand All @@ -15,17 +14,17 @@ def calculate_perpendicular_baselines(reference, stack):
product['noStateVectors'] = True
continue

asc_node_time = dateparser.parse(product['ascendingNodeTime']).timestamp()
asc_node_time = ciso8601.parse_datetime(product['ascendingNodeTime']).timestamp()

start = dateparser.parse(product['startTime']).timestamp()
end = dateparser.parse(product['stopTime']).timestamp()
start = ciso8601.parse_datetime(product['startTime']).timestamp()
end = ciso8601.parse_datetime(product['stopTime']).timestamp()
center = start + ((end - start) / 2)
product['relative_start_time'] = start - asc_node_time
product['relative_center_time'] = center - asc_node_time
product['relative_end_time'] = end - asc_node_time

t_pre = dateparser.parse(product['sv_t_pos_pre']).timestamp()
t_post = dateparser.parse(product['sv_t_pos_post']).timestamp()
t_pre = ciso8601.parse_datetime(product['sv_t_pos_pre']).timestamp()
t_post = ciso8601.parse_datetime(product['sv_t_pos_post']).timestamp()
product['relative_sv_pre_time'] = t_pre - asc_node_time
product['relative_sv_post_time'] = t_post - asc_node_time

Expand Down
6 changes: 3 additions & 3 deletions SearchAPI/Baseline/Stack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dateparser
import ciso8601
from SearchAPI.CMR.Translate import translate_params, input_fixer
from SearchAPI.CMR.Query import CMRQuery
from .Calc import calculate_perpendicular_baselines
Expand Down Expand Up @@ -178,13 +178,13 @@ def get_default_product_type(reference):
def calculate_temporal_baselines(reference, stack):
for product in stack:
if product['granuleName'] == reference:
reference_start = dateparser.parse(product['startTime'])
reference_start = ciso8601.parse_datetime(product['startTime'])
break
for product in stack:
if product['granuleName'] == reference:
product['temporalBaseline'] = 0
else:
start = dateparser.parse(product['startTime'])
start = ciso8601.parse_datetime(product['startTime'])
product['temporalBaseline'] = (start.date() - reference_start.date()).days
return stack

Expand Down
16 changes: 12 additions & 4 deletions SearchAPI/CMR/Output/geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,21 @@ def getItem(self, p):
except TypeError:
pass

if p.get('absoluteOrbit') is not None and len(p.get('absoluteOrbit')):
p['absoluteOrbit'] = p['absoluteOrbit'][0]

coordinates = []

if p.get('shape') is not None:
coordinates = [
[[float(c['lon']), float(c['lat'])] for c in p.get('shape')]
]

result = {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [
[[float(c['lon']), float(c['lat'])] for c in p['shape']]
]
'coordinates': coordinates
},
'properties': {
'beamModeType': p['beamModeType'],
Expand All @@ -82,7 +90,7 @@ def getItem(self, p):
'insarStackId': p['insarGrouping'],
'md5sum': p['md5sum'],
'offNadirAngle': p['offNadirAngle'],
'orbit': p['absoluteOrbit'][0],
'orbit': p['absoluteOrbit'],
'pathNumber': p['relativeOrbit'],
'platform': p['platform'],
'pointingAngle': p['pointingAngle'],
Expand Down
13 changes: 11 additions & 2 deletions SearchAPI/CMR/Output/jsonlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def req_fields_jsonlite():
'subswath',
'pgeVersion',
'operaBurstID',
'additionalUrls'
'additionalUrls',
's3Urls'
]
return fields

Expand Down Expand Up @@ -181,7 +182,15 @@ def getItem(self, p):
if p.get('operaBurstID') is not None or result['productID'].startswith('OPERA'):
result['opera'] = {
'operaBurstID': p.get('operaBurstID'),
'additionalUrls': p.get('additionalUrls')
'additionalUrls': p.get('additionalUrls'),
}
if p.get('validityStartDate'):
result['opera']['validityStartDate'] = p.get('validityStartDate')

if p.get('platform') == 'NISAR':
result['nisar'] = {
'additionalUrls': p.get('additionalUrls', []),
's3Urls': p.get('s3Urls', [])
}

return result
3 changes: 3 additions & 0 deletions SearchAPI/CMR/Output/jsonlite2.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ def getItem(self, p):
if p.get('opera') is not None:
result['s1o'] = p['opera']

if p.get('nisar') is not None:
result['nsr'] = p['nisar']

return result
2 changes: 1 addition & 1 deletion SearchAPI/CMR/Query.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def chunk_list(source_list, n):
if chunk_type in params:
params[chunk_type] = chunk_list(list(set(params[chunk_type])), 500) # distinct and split

list_param_names = ['platform', 'collections'] # these parameters will dodge the subquery system
list_param_names = ['platform', 'collections', 'shortname'] # these parameters will dodge the subquery system

for k, v in params.items():
if k in list_param_names:
Expand Down
17 changes: 13 additions & 4 deletions SearchAPI/CMR/SubQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from flask import request

from SearchAPI.asf_env import get_config
from SearchAPI.CMR.Translate import parse_cmr_response
from SearchAPI.CMR.Translate import parse_cmr_response, platform_datasets
from SearchAPI.CMR.Exceptions import CMRError

import boto3
Expand All @@ -25,6 +25,9 @@ def __init__(self, req_fields, params, extra_params):
self.headers = {}

token = request.args.get("cmr_token")
if token is None:
token = request.form.get('cmr_token')

if token != None:
self.headers['Authorization'] = f'Bearer {token}'

Expand Down Expand Up @@ -58,9 +61,15 @@ def combine_params(self, params, extra_params):

def should_use_asf_frame(self):
asf_frame_platforms = ['SENTINEL-1A', 'SENTINEL-1B', 'ALOS']

asf_frame_datasets = ['SENTINEL-1', 'OPERA-S1', 'SLC-BURST', 'ALOS PALSAR', 'ALOS AVNIR-2']

asf_frame_collections = []
for dataset in asf_frame_datasets:
asf_frame_collections.extend(platform_datasets.get(dataset))

return any([
p[0] == 'platform[]' and p[1] in asf_frame_platforms
p[0] == 'platform[]' and p[1] in asf_frame_platforms
or p[0] == 'echo_collection_id[]' and p[1] in asf_frame_collections
for p in self.params
])

Expand Down Expand Up @@ -167,7 +176,7 @@ def get_page(self, session):
query_duration = perf_counter() - q_start
logging.debug(f'CMR query time: {query_duration}')

self.log_subquery_time({'time': query_duration, 'status': response.status_code})
# self.log_subquery_time({'time': query_duration, 'status': response.status_code})

if query_duration > 10:
self.log_slow_cmr_response(session, response, query_duration)
Expand Down
135 changes: 133 additions & 2 deletions SearchAPI/CMR/Translate/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"C1327985644-ASF",
"C1327985571-ASF",
"C1327985674-ASF",
"C2450786986-ASF",
"C1205428742-ASF",
"C1216244348-ASF",
"C1212201032-ASF",
Expand Down Expand Up @@ -71,7 +70,6 @@
"C1216244596-ASF",
"C1216244588-ASF",
"C1216244599-ASF",
"C1245953394-ASF",
"C1234413245-ASFDEV",
"C1234413263-ASFDEV",
"C1234413229-ASFDEV",
Expand Down Expand Up @@ -116,6 +114,8 @@
"OPERA-S1": [
"C2777443834-ASF",
"C2777436413-ASF",
"C2795135174-ASF", # RTC-STATIC
"C2795135668-ASF", # CSLC-STATIC
"C1258354200-ASF", # maybe extra?
"C1259982010-ASF",
"C1257995185-ASF",
Expand All @@ -125,6 +125,12 @@
"C1257995186-ASF",
"C1259974840-ASF",
],
"OPERA-S1-CALVAL": [
"C1260721945-ASF", # CSLC
"C2803501758-ASF",
"C1260721853-ASF", # RTC
"C2803501097-ASF",
],
"SLC-BURST": ["C2709161906-ASF", "C1257024016-ASF"],
"ALOS PALSAR": [
"C1206487504-ASF",
Expand Down Expand Up @@ -362,4 +368,129 @@
"C1206752770-ASF",
"C1206144699-ASF",
],
# TODO: add check for item['umm']['SpatialExtent']['GranuleSpatialRepresentation'] == 'NO_SPATIAL'
"NISAR": [ # UAT ASFDEV
"C1261815181-ASFDEV",
"C1261832381-ASFDEV",
"C1256533420-ASFDEV",
"C1261813453-ASFDEV",
"C1261832466-ASFDEV",
"C1256524081-ASFDEV",
"C1261815274-ASFDEV",
"C1261832497-ASFDEV",
"C1256358262-ASFDEV",
"C1261815276-ASFDEV",
"C1261832632-ASFDEV",
"C1256358463-ASFDEV",
"C1261813489-ASFDEV",
"C1261832868-ASFDEV",
"C1256363301-ASFDEV",
"C1261819086-ASFDEV",
"C1261832940-ASFDEV",
"C1256381769-ASFDEV",
"C1261819098-ASFDEV",
"C1261832990-ASFDEV",
"C1256420738-ASFDEV",
"C1261819110-ASFDEV",
"C1261832993-ASFDEV",
"C1256411631-ASFDEV",
"C1261819167-ASFDEV",
"C1261833024-ASFDEV",
"C1256413628-ASFDEV",
"C1261819168-ASFDEV",
"C1261833025-ASFDEV",
"C1256432264-ASFDEV",
"C1261819211-ASFDEV",
"C1261833026-ASFDEV",
"C1256477304-ASFDEV",
"C1261819233-ASFDEV",
"C1261833027-ASFDEV",
"C1256479237-ASFDEV",
"C1261819245-ASFDEV",
"C1261833050-ASFDEV",
"C1256568692-ASFDEV",
"C1262134528-ASFDEV",
# UAT
"C1261815288-ASF",
"C1261832657-ASF",
"C1257349121-ASF",
"C1261815147-ASF",
"C1261832658-ASF",
"C1257349120-ASF",
"C1261815289-ASF",
"C1261832659-ASF",
"C1257349115-ASF",
"C1261815301-ASF",
"C1261832671-ASF",
"C1257349114-ASF",
"C1261815148-ASF",
"C1261833052-ASF",
"C1257349109-ASF",
"C1261819120-ASF",
"C1261833063-ASF",
"C1257349108-ASF",
"C1261819121-ASF",
"C1261833064-ASF",
"C1257349107-ASF",
"C1261819145-ASF",
"C1261833076-ASF",
"C1257349103-ASF",
"C1261819258-ASF",
"C1261833127-ASF",
"C1257349102-ASF",
"C1261819270-ASF",
"C1261846741-ASF",
"C1257349096-ASF",
"C1261819275-ASF",
"C1261846880-ASF",
"C1257349095-ASF",
"C1261819281-ASF",
"C1261846994-ASF",
"C1257349094-ASF",
"C1261819282-ASF",
"C1261847095-ASF",
"C1257349093-ASF",
"C1262135006-ASF",
# PROD
"C2850220296-ASF",
"C2853068083-ASF",
"C2727902012-ASF",
"C2850223384-ASF",
"C2853086824-ASF",
"C2727901263-ASF",
"C2850224301-ASF",
"C2853089814-ASF",
"C2727901639-ASF",
"C2850225137-ASF",
"C2853091612-ASF",
"C2727901523-ASF",
"C2850225585-ASF",
"C2853145197-ASF",
"C2727900439-ASF",
"C2850234202-ASF",
"C2853147928-ASF",
"C2723110181-ASF",
"C2850235455-ASF",
"C2853153429-ASF",
"C2727900827-ASF",
"C2850237619-ASF",
"C2853156054-ASF",
"C2727900080-ASF",
"C2850259510-ASF",
"C2854332392-ASF",
"C2727896667-ASF",
"C2850261892-ASF",
"C2854335566-ASF",
"C2727897718-ASF",
"C2850262927-ASF",
"C2854338529-ASF",
"C2727896018-ASF",
"C2850263910-ASF",
"C2854341702-ASF",
"C2727896460-ASF",
"C2850265000-ASF",
"C2854344945-ASF",
"C2727894546-ASF",
"C2874824964-ASF"
],
}
1 change: 1 addition & 0 deletions SearchAPI/CMR/Translate/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def get_field_paths():
'track': attr_path('PATH_NUMBER'),
'pgeVersion': "./PGEVersionClass/PGEVersion",
'additionalUrls': "./OnlineAccessURLs",
's3Urls': "./OnlineAccessURLs",

# BURST FIELDS
'absoluteBurstID': attr_path('BURST_ID_ABSOLUTE'),
Expand Down
10 changes: 6 additions & 4 deletions SearchAPI/CMR/Translate/input_fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ def input_fixer(params, is_prod: bool = False, provider: str = "ASF"):
if any_processing_level:
fixed_params['collections'] = collection_list

elif k == 'datasets':
elif k == 'dataset':
fixed_params['collections'] = []
for dataset in params[k]:
logging.warn(dataset)
logging.warn(platform_datasets.get(dataset))
fixed_params['collections'].extend(platform_datasets.get(dataset))
if platform_datasets.get(dataset):
fixed_params['collections'].extend(platform_datasets.get(dataset))
else:
raise ValueError(f'Could not find dataset named "{dataset}" provided for dataset keyword.')

logging.warn(fixed_params)
elif k == 'beammode':
beammap = {
Expand Down
Loading
Loading