Skip to content

Commit 3c33664

Browse files
Merge pull request #245 from ASFHyP3/develop
Release: v0.6.0
2 parents e2ef096 + 35bc9e5 commit 3c33664

File tree

14 files changed

+314
-51
lines changed

14 files changed

+314
-51
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
AWS_REGION: us-west-2
1111
TEMPLATE_BUCKET: cf-templates-aubvn3i9olmk-us-west-2
1212
RTC_GAMMA_REPOSITORY: 626226570674.dkr.ecr.us-east-1.amazonaws.com/hyp3-rtc-gamma
13+
INSAR_GAMMA_REPOSITORY: 626226570674.dkr.ecr.us-east-1.amazonaws.com/hyp3-insar-gamma
1314

1415
VPC_ID: ${{ secrets.VPC_ID }}
1516
SUBNET_IDS: ${{ secrets.SUBNET_IDS }}
@@ -77,6 +78,7 @@ jobs:
7778
EDLUsername="${EDL_USERNAME}" \
7879
EDLPassword="${EDL_PASSWORD}" \
7980
RtcGammaImage="${RTC_GAMMA_REPOSITORY}:${IMAGE_TAG}" \
81+
InsarGammaImage="${INSAR_GAMMA_REPOSITORY}:${IMAGE_TAG}" \
8082
DomainName="${DOMAIN_NAME}" \
8183
CertificateArn="${CERTIFICATE_ARN}"
8284

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.6.0]
8+
### Added
9+
- Added a new `INSAR_GAMMA` job type for producing an interferogram from a pair of Sentinel-1 SLC IW scenes using [GAMMA](https://www.gamma-rs.ch/software). For details, refer to the [hyp3-insar-gamma](https://github.com/ASFHyP3/hyp3-insar-gamma) plugin repository.
10+
11+
### Changed
12+
- All job types requiring one or more granules now expose a single `granules` job parameter, formatted as a list of granule names:
13+
- `"granules": ["myGranule"]` for `RTC_GAMMA` jobs
14+
- `"granules": ["granule1", "granule2"]` for `INSAR_GAMMA` jobs
15+
16+
Note this is a breaking change for `RTC_GAMMA` jobs.
17+
- Browse and thumbnail URLs for `RTC_GAMMA` jobs will now be sorted with the amplitude image first, followed by the rgb image, in `GET /jobs` responses.
18+
719
## [0.5.1]
820
### Fixed
921
- Resolved HTTP 500 error when submitting jobs with a resolution with decimal precision (e.g. `30.0`)

api/src/hyp3_api/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from flask_cors import CORS
1212

1313
from hyp3_api import DYNAMODB_RESOURCE, connexion_app
14-
from hyp3_api.util import convert_floats_to_decimals, format_time, get_remaining_jobs_for_user, \
14+
from hyp3_api.util import convert_floats_to_decimals, format_time, get_granules, get_remaining_jobs_for_user, \
1515
get_request_time_expression
1616
from hyp3_api.validation import GranuleValidationError, validate_granules
1717

@@ -47,7 +47,7 @@ def post_jobs(body, user):
4747
return problem(400, 'Bad Request', message)
4848

4949
try:
50-
granules = [job['job_parameters']['granule'] for job in body['jobs']]
50+
granules = get_granules(body['jobs'])
5151
validate_granules(granules)
5252
except requests.HTTPError as e:
5353
print(f'WARN: CMR search failed: {e}')

api/src/hyp3_api/openapi-spec.yml

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ components:
136136
- job_type
137137
- job_parameters
138138
additionalProperties: false
139+
example:
140+
job_parameters:
141+
granules:
142+
- S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8
143+
job_type: RTC_GAMMA
144+
name: Job Name
145+
139146
properties:
140147
job_type:
141148
$ref: "#/components/schemas/job_type"
@@ -205,16 +212,39 @@ components:
205212
example: RTC_GAMMA
206213
enum:
207214
- RTC_GAMMA
215+
- INSAR_GAMMA
208216

209217
job_parameters:
218+
oneOf:
219+
- $ref: "#/components/schemas/rtc_gamma_job_parameters"
220+
- $ref: "#/components/schemas/insar_gamma_job_parameters"
221+
222+
insar_gamma_job_parameters:
223+
description: Options and parameters for running the job process.
224+
type: object
225+
required:
226+
- granules
227+
additionalProperties: false
228+
properties:
229+
granules:
230+
$ref: "#/components/schemas/insar_gamma_granules"
231+
include_inc_map:
232+
$ref: "#/components/schemas/include_inc_map"
233+
looks:
234+
$ref: "#/components/schemas/looks"
235+
include_los_displacement:
236+
$ref: "#/components/schemas/los_displacement"
237+
238+
239+
rtc_gamma_job_parameters:
210240
description: Options and parameters for running the job process.
211241
type: object
212242
required:
213-
- granule
243+
- granules
214244
additionalProperties: false
215245
properties:
216-
granule:
217-
$ref: "#/components/schemas/granule"
246+
granules:
247+
$ref: "#/components/schemas/rtc_gamma_granules"
218248
resolution:
219249
$ref: "#/components/schemas/resolution"
220250
radiometry:
@@ -230,10 +260,35 @@ components:
230260
include_inc_map:
231261
$ref: "#/components/schemas/include_inc_map"
232262

233-
granule:
234-
description: The name of the Sentinel-1 granule to process. Only SLC and GRDH products with beam mode IW are supported.
263+
insar_gamma_granules:
264+
type: array
265+
minItems: 2
266+
maxItems: 2
267+
items:
268+
$ref: "#/components/schemas/granule_slc"
269+
270+
rtc_gamma_granules:
271+
type: array
272+
minItems: 1
273+
maxItems: 1
274+
items:
275+
anyOf:
276+
- $ref: "#/components/schemas/granule_grdh"
277+
- $ref: "#/components/schemas/granule_slc"
278+
279+
280+
granule_grdh:
281+
description: The name of the Sentinel-1 GRDH granule to process.
235282
type: string
236-
pattern: "^S1[AB]_IW_(SLC_|GRDH)_*"
283+
pattern: "^S1[AB]_IW_GRDH_*"
284+
minLength: 67
285+
maxLength: 67
286+
example: S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8
287+
288+
granule_slc:
289+
description: The name of the Sentinel-1 SLC granule to process.
290+
type: string
291+
pattern: "^S1[AB]_IW_SLC__*"
237292
minLength: 67
238293
maxLength: 67
239294
example: S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8
@@ -278,6 +333,18 @@ components:
278333
default: false
279334
type: boolean
280335

336+
looks:
337+
description: Number of looks to take in range and azimuth
338+
type: string
339+
enum:
340+
- 20x4
341+
- 10x2
342+
343+
los_displacement:
344+
description: Include a GeoTIFF in the product package containing the displacements along the Line-Of-Sight (LOS)
345+
default: false
346+
type: boolean
347+
281348
datetime:
282349
description: Date and time object formatted according to ISO 8601
283350
type: string

api/src/hyp3_api/util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
from hyp3_api import handlers
99

1010

11+
def get_granules(jobs):
12+
granules = set()
13+
for job in jobs:
14+
for granule in job['job_parameters']['granules']:
15+
granules.add(granule)
16+
return granules
17+
18+
1119
def format_time(time: datetime):
1220
if time.tzinfo is None:
1321
raise ValueError(f'missing tzinfo for datetime {time}')

api/tests/conftest.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from moto import mock_dynamodb2
99

1010
from hyp3_api import CMR_URL, DYNAMODB_RESOURCE, auth, connexion_app # noqa hyp3 must be imported here
11+
from hyp3_api.util import get_granules
1112

1213
AUTH_COOKIE = 'asf-urs'
1314
JOBS_URI = '/jobs'
@@ -45,14 +46,15 @@ def get_table_properties_from_template():
4546
return table_properties
4647

4748

48-
def make_job(granule='S1B_IW_SLC__1SDV_20200604T082207_20200604T082234_021881_029874_5E38',
49+
def make_job(granules=['S1B_IW_SLC__1SDV_20200604T082207_20200604T082234_021881_029874_5E38'],
4950
name='someName',
50-
job_type='RTC_GAMMA'):
51+
job_type='RTC_GAMMA',
52+
parameters={},):
5153
job = {
5254
'job_type': job_type,
5355
'job_parameters': {
54-
'granule': granule,
55-
'resolution': 30.0,
56+
'granules': granules,
57+
**parameters
5658
}
5759
}
5860
if name is not None:
@@ -73,7 +75,7 @@ def submit_batch(client, batch=None, validate_only=None):
7375

7476

7577
def make_db_record(job_id,
76-
granule='S1A_IW_SLC__1SDV_20200610T173646_20200610T173704_032958_03D14C_5F2B',
78+
granules=['S1A_IW_SLC__1SDV_20200610T173646_20200610T173704_032958_03D14C_5F2B'],
7779
job_type='RTC_GAMMA',
7880
user_id=DEFAULT_USERNAME,
7981
request_time='2019-12-31T15:00:00+00:00',
@@ -88,7 +90,7 @@ def make_db_record(job_id,
8890
'user_id': user_id,
8991
'job_type': job_type,
9092
'job_parameters': {
91-
'granule': granule,
93+
'granules': granules,
9294
},
9395
'request_time': request_time,
9496
'status_code': status_code,
@@ -107,7 +109,7 @@ def make_db_record(job_id,
107109

108110

109111
def setup_requests_mock(batch):
110-
granules = [job['job_parameters']['granule'] for job in batch]
112+
granules = get_granules(batch)
111113
cmr_response = {
112114
'feed': {
113115
'entry': [

api/tests/test_submit_job.py

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,32 @@ def test_submit_one_job(client, table):
1717
assert jobs[0]['user_id'] == DEFAULT_USERNAME
1818

1919

20+
def test_submit_insar_gamma(client, table):
21+
login(client)
22+
job = make_job(
23+
[
24+
'S1A_IW_SLC__1SDV_20200720T172109_20200720T172128_033541_03E2FB_341F',
25+
'S1A_IW_SLC__1SDV_20200813T172110_20200813T172129_033891_03EE3F_2C3E'
26+
],
27+
job_type='INSAR_GAMMA'
28+
)
29+
response = submit_batch(client, batch=[job])
30+
assert response.status_code == status.HTTP_200_OK
31+
32+
33+
def test_submit_multiple_job_types(client, table):
34+
login(client)
35+
job = make_job(
36+
[
37+
'S1A_IW_SLC__1SDV_20200720T172109_20200720T172128_033541_03E2FB_341F',
38+
'S1A_IW_SLC__1SDV_20200813T172110_20200813T172129_033891_03EE3F_2C3E'
39+
],
40+
job_type='INSAR_GAMMA'
41+
)
42+
response = submit_batch(client, batch=[job, make_job()])
43+
assert response.status_code == status.HTTP_200_OK
44+
45+
2046
def test_submit_many_jobs(client, table):
2147
max_jobs = 25
2248
login(client)
@@ -96,11 +122,11 @@ def test_submit_job_with_long_name(client):
96122

97123
def test_submit_job_granule_does_not_exist(client, table):
98124
batch = [
99-
make_job('S1B_IW_SLC__1SDV_20200604T082207_20200604T082234_021881_029874_5E38'),
100-
make_job('S1A_IW_SLC__1SDV_20200610T173646_20200610T173704_032958_03D14C_5F2B')
125+
make_job(['S1B_IW_SLC__1SDV_20200604T082207_20200604T082234_021881_029874_5E38']),
126+
make_job(['S1A_IW_SLC__1SDV_20200610T173646_20200610T173704_032958_03D14C_5F2B'])
101127
]
102128
setup_requests_mock(batch)
103-
batch.append(make_job('S1A_IW_SLC__1SDV_20200610T173646_20200610T173704_032958_03D14C_5F2A'))
129+
batch.append(make_job(['S1A_IW_SLC__1SDV_20200610T173646_20200610T173704_032958_03D14C_5F2A']))
104130

105131
login(client)
106132
response = submit_batch(client, batch)
@@ -120,7 +146,7 @@ def test_submit_good_granule_names(client, table):
120146
]
121147
for granule in good_granule_names:
122148
batch = [
123-
make_job(granule),
149+
make_job([granule]),
124150
]
125151
setup_requests_mock(batch)
126152
response = submit_batch(client, batch)
@@ -155,6 +181,19 @@ def test_submit_bad_granule_names(client):
155181
assert response.status_code == status.HTTP_400_BAD_REQUEST
156182

157183

184+
def test_float_input(client, table):
185+
login(client)
186+
job = make_job(parameters={'resolution': 30.0})
187+
response = submit_batch(client, batch=[job])
188+
assert response.status_code == status.HTTP_200_OK
189+
assert isinstance(response.json['jobs'][0]['job_parameters']['resolution'], float)
190+
191+
job = make_job(parameters={'resolution': 30})
192+
response = submit_batch(client, batch=[job])
193+
assert response.status_code == status.HTTP_200_OK
194+
assert isinstance(response.json['jobs'][0]['job_parameters']['resolution'], int)
195+
196+
158197
def test_submit_validate_only(client, table):
159198
login(client)
160199

0 commit comments

Comments
 (0)