Skip to content

Commit

Permalink
Merge pull request #216 from ASFHyP3/merge-time-parse
Browse files Browse the repository at this point in the history
Update time parsing in `merge-tops-bursts.py`
  • Loading branch information
forrestfwilliams authored Jul 2, 2024
2 parents 9d6d64a + 2925b39 commit b09bfbb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.2]
### Fixed
* Renamed `hyp3_isce2.logging` to `hyp3_isce2.logger` to avoid shadowing built-in.
* Source of product start times in `merge_tops_bursts` to use the `asf_search` umm record.

## [1.1.1]
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/hyp3_isce2/merge_tops_bursts.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ def get_burst_metadata(product_paths: Iterable[Path]) -> Iterable[BurstProduct]:
burst_ids = [result.properties['burst']['relativeBurstID'] for result in results]
burst_indexes = [result.properties['burst']['burstIndex'] for result in results]
polarization = [result.properties['polarization'] for result in results]
start_utc = [
datetime.datetime.strptime(result.properties['startTime'], '%Y-%m-%dT%H:%M:%S.%fZ') for result in results
]

start_utc_strs = [result.umm['TemporalExtent']['RangeDateTime']['BeginningDateTime'] for result in results]
start_utc = [datetime.datetime.strptime(utc, '%Y-%m-%dT%H:%M:%S.%fZ') for utc in start_utc_strs]
relative_orbits = [result.properties['pathNumber'] for result in results]
n_lines = [int(meta['Radarnlines']) for meta in metas]
n_samples = [int(meta['Radarnsamples']) for meta in metas]
Expand Down
3 changes: 2 additions & 1 deletion src/hyp3_isce2/water_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def create_water_mask(input_image: str, output_image: str, gdal_format='ISCE', t
merged_warped_path,
f'--outfile={output_image}',
'--calc="numpy.abs((A.astype(numpy.int16) + 1) - 2)"', # Change 1's to 0's and 0's to 1's.
f'--format={gdal_format}'
f'--format={gdal_format}',
'--overwrite',
]
subprocess.run(flip_values_command, check=True)
6 changes: 4 additions & 2 deletions tests/test_merge_tops_bursts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ def mock_asf_search_results(
path_number: int,
) -> asf_search.ASFSearchResults:
product = asf_search.ASFProduct()
product.umm = {'InputGranules': [slc_name]}
product.umm = {
'InputGranules': [slc_name],
'TemporalExtent': {'RangeDateTime': {'BeginningDateTime': '2020-06-04T02:23:13.963847Z'}},
}
product.properties.update(
{
'burst': {'subswath': subswath, 'burstIndex': burst_index, 'relativeBurstID': burst_id},
'polarization': polarization,
'url': f'https://foo.com/{slc_name}/baz.zip',
'startTime': '2020-06-04T02:23:13.963847Z',
'pathNumber': path_number,
}
)
Expand Down

0 comments on commit b09bfbb

Please sign in to comment.