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

Update time parsing in merge-tops-bursts.py #216

Merged
merged 8 commits into from
Jul 2, 2024
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
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