Skip to content

Commit 9c11f1b

Browse files
authored
Merge pull request #134 from betonr/master
fix code - when noscenes in tile/period
2 parents 6eca05b + 5ce35f6 commit 9c11f1b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cube_builder_aws/cube_builder_aws/maestro.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,13 @@ def prepare_merge(self, datacube, irregular_datacube, datasets, satellite, bands
233233
# Evaluate the number of dates, the number of scenes for each date and
234234
# the total amount merges that will be done
235235
number_of_datasets_dates = 0
236-
first_band = list(self.score['items'][tile_name]['periods'][periodkey]['scenes'].keys())[0]
237-
activity['list_dates'] = []
238-
for dataset in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band].keys():
239-
for date in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band][dataset].keys():
240-
activity['list_dates'].append(date)
241-
number_of_datasets_dates += 1
236+
if len(self.score['items'][tile_name]['periods'][periodkey]['scenes'].keys()):
237+
first_band = list(self.score['items'][tile_name]['periods'][periodkey]['scenes'].keys())[0]
238+
activity['list_dates'] = []
239+
for dataset in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band].keys():
240+
for date in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band][dataset].keys():
241+
activity['list_dates'].append(date)
242+
number_of_datasets_dates += 1
242243

243244
activity['instancesToBeDone'] = number_of_datasets_dates
244245
activity['totalInstancesToBeDone'] = number_of_datasets_dates * len(activity['bands'])

0 commit comments

Comments
 (0)