Commit 63ab6b59 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

SICOR implementation working for Sentinel-2

parent edf9ea75
......@@ -15,6 +15,7 @@ import warnings
import re
import logging
import dill
import traceback
import numpy as np
try:
......@@ -32,8 +33,9 @@ from ..model.METADATA import get_LayerBandsAssignment
from ..misc.definition_dicts import get_outFillZeroSaturated, proc_chain
from ..io.Input_reader import SRF
from S2SCAPEM.s2_ac import AC_GMS
from S2MSI import RSImage, S2Mask
from sicor.sicor_ac import ac_gms
from sicor.sensors.S2MSI import RSImage
from sicor.Mask import S2Mask
########################### core functions ####################################
......@@ -393,7 +395,7 @@ class AtmCorr(object):
@property
def tile_name(self):
"""Returns S2A tile name.
NOTE: this is only needed if no DEM is passed to AC_GMS
NOTE: this is only needed if no DEM is passed to ac_gms
:return: e.g.
'32UMA'
......@@ -747,7 +749,7 @@ class AtmCorr(object):
self.logger.info('Atmospheric correction started.')
try:
rs_image.logger = self.logger
self.results = AC_GMS(rs_image, self.options, logger=self.logger, script=script)
self.results = ac_gms(rs_image, self.options, logger=self.logger, script=script)
except Exception as e:
# serialialize AC input
if dump_ac_input:
......@@ -765,8 +767,10 @@ class AtmCorr(object):
self.logger.error('\nAn error occurred during atmospheric correction. BE AWARE THAT THE SCENE %s '
'(ENTITY ID %s) HAS NOT BEEN ATMOSPHERICALLY CORRECTED! Error message was: \n%s\n'
%(self.inObjs[0].scene_ID, self.inObjs[0].entity_ID, repr(e)) )
self.logger.error("Print traceback in case you care:")
self.logger.error(traceback.format_exc())
# TODO include that in the job summary!
#raise
return list(self.inObjs)
......@@ -808,7 +812,7 @@ class AtmCorr(object):
if self.results.data_ac is not None:
for inObj in self.inObjs:
# assert isinstance(inObj.arr, (GeoArray, np.ndarray)), print(type(inObj.arr))
assert isinstance(inObj, L1B_object)
nodata = self.results.nodata[inObj.arr.xgsd] # 2D mask with True outside of image coverage
ac_bandNs = [bandN for bandN in inObj.arr.bandnames if bandN in self.results.data_ac.keys()]
out_LBA = [bN.split('B0')[1] if bN.startswith('B0') else bN.split('B')[1] for bN in ac_bandNs]
......
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