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

Merge branch 'bugfix/fix_noAC_spectral_homgenization' into 'master'

Bugfix/fix no ac spectral homgenization

See merge request !9
parents f389497c 862a2aca
Pipeline #8094 passed with stages
in 17 minutes and 38 seconds
......@@ -2,6 +2,14 @@
History
=======
0.18.3 (coming soon)
--------------------
* Fixed fallback algorithm within spectral homogenization.
* Input radiometric unit of spectral homogenization is now checked. Linear interpolation is used if its not BOA_Ref.
0.18.2 (2020-04-02)
-------------------
......
......@@ -911,7 +911,7 @@ class AtmCorr(object):
self.logger.error(traceback.format_exc())
# TODO include that in the job summary
# serialialize AC input
# serialize AC input
if dump_ac_input:
path_dump = self.inObjs[0].pathGen.get_path_ac_input_dump()
with open(path_dump, 'wb') as outF:
......
......@@ -107,14 +107,19 @@ class L2B_object(L2A_object):
logger=self.logger,
CPUs=CFG.CPUs if is_mainprocess() else 1)
if method == 'LI' or CFG.datasetid_spectral_ref is None:
if method == 'LI' or CFG.datasetid_spectral_ref is None or self.arr_desc != 'BOA_Ref':
# linear interpolation (if intended by user or in case of custom spectral characteristics of target sensor)
# -> no classifier for that case available -> linear interpolation
if self.arr_desc != 'BOA_Ref' and CFG.target_radunit_optical == 'BOA_Ref':
self.logger.warning("Spectral homogenization with an '%s' classifier is not possible because the input "
"image is not atmospherically corrected (BOA reflectance is needed). Falling back "
"to linear spectral interpolation." % method)
im = SpH.interpolate_cube(self.arr, src_cwls, tgt_cwl, kind='linear')
if CFG.spechomo_estimate_accuracy:
self.logger.warning("Unable to compute any error information in case spectral homogenization algorithm "
"is set to 'LI' (Linear Interpolation)")
"is set to 'LI' (Linear Interpolation).")
errs = None
......@@ -131,13 +136,16 @@ class L2B_object(L2A_object):
n_clusters=CFG.spechomo_n_clusters,
classif_alg=CFG.spechomo_classif_alg,
kNN_n_neighbors=CFG.spechomo_kNN_n_neighbors,
nodataVal=self.arr.nodata,
src_nodataVal=self.arr.nodata,
out_nodataVal=self.arr.nodata,
compute_errors=CFG.spechomo_estimate_accuracy,
bandwise_errors=CFG.spechomo_bandwise_accuracy,
fallback_argskwargs=dict(
args=dict(source_CWLs=src_cwls, target_CWLs=tgt_cwl,),
kwargs=dict(kind='linear')
))
arrcube=self.arr,
source_CWLs=src_cwls,
target_CWLs=tgt_cwl,
kind='linear')
)
###################
# update metadata #
......
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