Commit 37a7f8c9 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Intermediate state before moving the creation of a combined accuracy layer cube to L2C processor.

Changed default virtual sensor id to 11 (S2, 20m).
parent 92ef7f6e
......@@ -984,7 +984,14 @@ class AtmCorr(object):
ac_errors = np.dstack((self.results.data_errors[bandN] for bandN in ac_bandNs))
if not bandwise:
ac_errors = np.nanmedian(ac_errors, axis=2).astype(ac_errors.dtype)
# in case of only one subsystem: directly compute median errors here
if len(self.inObjs) == 1:
ac_errors = np.nanmedian(ac_errors, axis=2).astype(ac_errors.dtype)
# in case of multiple subsystems: dont compute median here but first apply geometric homogenization
# -> median could only be computed for each subsystem separately
else:
pass
# apply scale factor from config to data pixels and overwrite nodata area with nodata value
ac_errors *= CFG.ac_scale_factor_errors # scale using scale factor (output is float16)
......
......@@ -449,6 +449,13 @@ class GMS_object(Dataset):
else:
self.logger.info('Generating combined accuracy layers array..')
if 'ac_errors' in errs_data and self.proc_level == 'L1C' and not CFG.ac_bandwise_accuracy:
errs_data['ac_errors'] = GeoArray(np.median(errs_data['ac_errors'], axis=2),
geotransform=errs_data['ac_errors'].geotransform,
projection=errs_data['ac_errors'].projection,
bandnames=['median AC errors']
)
# set accuracy_layers
self._accuracy_layers = GeoArray(np.array(np.dstack(errs_data.values()), dtype='int16'),
geotransform=list(errs_data.values())[0].geotransform,
......@@ -767,6 +774,7 @@ class GMS_object(Dataset):
# validate output GeoArrays #
#############################
if len([gA for gA in geoArrs_same_extent if gA is not None]) > 1:
equal_bounds = all([geoArrs_same_extent[0].box.boundsMap == gA.box.boundsMap
for gA in geoArrs_same_extent[1:]])
......@@ -779,9 +787,9 @@ class GMS_object(Dataset):
# set output arrays #
#####################
if attrname in ['arr', 'ac_errors'] and list(set(geoArrs_same_extent)) != [None]:
# the bands of these arrays have to be reordered according to FullLayerBandsAssignment
# handle those arrays where bands have to be reordered according to FullLayerBandsAssignment
if attrname in ['arr', 'ac_errors'] and list(set(geoArrs_same_extent)) != [None]:
# check that each desired band name for the current attribute is provided by one of the input
# GMS objects
available_bandNs = list(chain.from_iterable([list(gA.bandnames) for gA in geoArrs_same_extent]))
......@@ -800,6 +808,7 @@ class GMS_object(Dataset):
nodata=geoArrs_same_extent[0].nodata)
setattr(self, attrname, full_geoArr)
# handle the remaining arrays
else:
# masks, dem, mask_nodata, mask_clouds, mask_clouds_confidence
if attrname == 'dem':
......
......@@ -139,7 +139,11 @@
"usecase": { /*NOTE: These options will be not respected in the WebApp! Use the WebApp GUI instead.*/
"virtual_sensor_id": 10, /*"None": use WebApp input; 1: Landsat-8, 10: Sentinel-2A 10m*/
"virtual_sensor_id": 11, /*"None": use WebApp input;
1: Landsat-8,
10: Sentinel-2A 10m
11: Sentinel-2A 20m
12: Sentinel-2A 60m*/
"datasetid_spatial_ref": 249, /*"None": use WebApp input*/
"datasetid_spectral_ref": 249, /*249=Sentinel-2A*/
"target_CWL": [
......
......@@ -108,8 +108,8 @@ class BaseTestCases:
[cls.validate_db_entry(ds['filename']) for ds in cls.PC.config.data_list]
cls.PC.config.ac_estimate_accuracy = True
cls.PC.config.spechomo_estimate_accuracy = True
cls.PC.config.ac_estimate_accuracy = True # FIXME
cls.PC.config.spechomo_estimate_accuracy = True # FIXME
def check_availability(self, GMS_objs, tgt_procL):
dss = self.PC.add_local_availability([GMS_object_2_dataset_dict(obj) for obj in GMS_objs])
......@@ -204,6 +204,9 @@ 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
def test_run_all_processors(self):
self.PC.run_all_processors()
self.assertIsInstance(self.PC.L2C_newObjects, list)
......
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