Commit a3f433fc authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fix for failed attempting to write accuracy layers although no accuracy layers have been produced.

parent 726e5b1a
......@@ -43,8 +43,7 @@ class AccuracyCube(GeoArray):
nodata=get_outFillZeroSaturated('int16')[0])
else:
# return an empty GeoArray
super(AccuracyCube, self).__init__(np.array([]))
raise ValueError('The given GMS_object contains no accuracy layers for combination.')
@property
def layers(self):
......
......@@ -443,6 +443,16 @@ class GMS_object(Dataset):
try:
from ..algorithms.L2C_P import AccuracyCube
self._accuracy_layers = AccuracyCube(self)
except ValueError as e:
if str(e) == 'The given GMS_object contains no accuracy layers for combination.':
if CFG.ac_estimate_accuracy or CFG.spechomo_estimate_accuracy:
raise
else:
pass # self._accuracy_layers keeps None
else:
raise
except Exception as e:
raise RuntimeError('Failed to generate AccuracyCube!', e)
......@@ -1285,8 +1295,12 @@ class GMS_object(Dataset):
if self.proc_level not in ['L1A', 'L1B'] and write_masks_as_ENVI_classification:
attributes2write.append('mask_clouds')
if self.proc_level == 'L2C': # and CFG.ac_estimate_accuracy or CFG.spechomo_estimate_accuracy:
attributes2write.append('accuracy_layers')
if self.proc_level == 'L2C':
if CFG.ac_estimate_accuracy or CFG.spechomo_estimate_accuracy:
attributes2write.append('accuracy_layers')
else:
self.logger.info('Accuracy layers are not written because their generation has been disabled in the '
'job configuration.')
###########################################################
# loop through all attributes to write and execute writer #
......
......@@ -204,8 +204,8 @@ class BaseTestCases:
[cls.validate_db_entry(ds['filename']) for ds in cls.PC.config.data_list]
cls.PC.config.ac_estimate_accuracy = True # FIXME
cls.PC.config.spechomo_estimate_accuracy = True # FIXME
# cls.PC.config.ac_estimate_accuracy = True # FIXME
# cls.PC.config.spechomo_estimate_accuracy = True # FIXME
def test_run_all_processors(self):
self.PC.run_all_processors()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment