Homogenization using kNN classifiers uses faulty weights in case SpectralHomogenizer.predict_by_machine_learner() is called with global_clf_threshold=None.
This is caused by https://gitext.gfz-potsdam.de/geomultisens/specclassify/-/issues/5 where nodata pixels are not flagged properly in this case.
Reproduce with:
SH = SpectralHomogenizer()
pred = SH.predict_by_machine_learner(
arrcube=GeoArray('/any/L7_image.tif', nodata=-9999),
method='LR',
src_satellite='Landsat-7',
src_sensor='ETM+',
src_LBA=['1', '2', '3', '4', '5', '7'],
tgt_satellite='Sentinel-2A',
tgt_sensor='MSI',
tgt_LBA=['1', '2', '3', '4', '5', '6', '7', '8', '8A', '11', '12'],
classif_alg='kNN_MinDist',
global_clf_threshold=None
)
Edited by Daniel Scheffler