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

Sort pairs by latitude #381

Merged
merged 1 commit into from
Sep 6, 2023
Merged
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
18 changes: 15 additions & 3 deletions tools/ARIAtools/ARIAProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ def __mappingVersion__(self, fname, version):
+ basename.split('-')[7][2:4] + ':' \
+ basename.split('-')[7][4:] + '.0'

# assign latitude to assist with sorting
rdrmetadata_dict['centerLatitude'] = \
basename.split('-')[8].split('_')[1]
if rdrmetadata_dict['centerLatitude'][-1] == 'S':
rdrmetadata_dict['centerLatitude'] = -1 * \
int(rdrmetadata_dict['centerLatitude'][:-1])
else:
rdrmetadata_dict['centerLatitude'] = \
int(rdrmetadata_dict['centerLatitude'][:-1])

#hardcoded keys for a given sensor
if basename.split('-')[0] == 'S1':
rdrmetadata_dict['missionID'] = 'Sentinel-1'
Expand Down Expand Up @@ -750,10 +760,12 @@ def __run__(self):
else:
self.products += self.__readproduct__(self.files[0])

# Sort by pair and start time.
# Sort by pair, start time, and latitude
self.products = [i for i in self.products if i != []]
self.products = sorted(self.products, key=lambda k:
(k[0]['pair_name'], k[0]['azimuthZeroDopplerMidTime']))
self.products = sorted(self.products, key=lambda i:
(i[0]['pair_name'],
i[0]['azimuthZeroDopplerMidTime'],
i[0]['centerLatitude']))
self.products = list(self.products)

# Exit if products from different sensors were mixed
Expand Down
Loading