From 5ce35f6fcfaa7620b4efdb2e06eec2f6bb80d03a Mon Sep 17 00:00:00 2001 From: Beto Noronha Date: Tue, 13 Apr 2021 22:36:53 -0300 Subject: [PATCH] fix code - when noscenes in tile/period --- cube_builder_aws/cube_builder_aws/maestro.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cube_builder_aws/cube_builder_aws/maestro.py b/cube_builder_aws/cube_builder_aws/maestro.py index 83c3960..3c57612 100644 --- a/cube_builder_aws/cube_builder_aws/maestro.py +++ b/cube_builder_aws/cube_builder_aws/maestro.py @@ -233,12 +233,13 @@ def prepare_merge(self, datacube, irregular_datacube, datasets, satellite, bands # Evaluate the number of dates, the number of scenes for each date and # the total amount merges that will be done number_of_datasets_dates = 0 - first_band = list(self.score['items'][tile_name]['periods'][periodkey]['scenes'].keys())[0] - activity['list_dates'] = [] - for dataset in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band].keys(): - for date in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band][dataset].keys(): - activity['list_dates'].append(date) - number_of_datasets_dates += 1 + if len(self.score['items'][tile_name]['periods'][periodkey]['scenes'].keys()): + first_band = list(self.score['items'][tile_name]['periods'][periodkey]['scenes'].keys())[0] + activity['list_dates'] = [] + for dataset in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band].keys(): + for date in self.score['items'][tile_name]['periods'][periodkey]['scenes'][first_band][dataset].keys(): + activity['list_dates'].append(date) + number_of_datasets_dates += 1 activity['instancesToBeDone'] = number_of_datasets_dates activity['totalInstancesToBeDone'] = number_of_datasets_dates * len(activity['bands'])