Commit 005a79ad authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Revised image classifiers. Added MinimumDistance_Classifier. Revised...

Revised image classifiers. Added MinimumDistance_Classifier. Revised RSImage_ClusterPredictor and Cluster_Learner.
Revised Test_SAM_Classifier.
parent cd7f2151
This diff is collapsed.
......@@ -274,9 +274,9 @@ class Test_SpectralHomogenizer(unittest.TestCase):
cfg = set_config(job_ID=26186196, db_host=db_host, reset_status=True, is_test=True)
cls.SpH = SpectralHomogenizer(classifier_rootDir=cfg.path_spechomo_classif)
cls.testArr_L8 = GeoArray(np.random.randint(1, 10000, (50, 50, 7), dtype=np.int16)) # no band 9, no pan
# cls.testArr_L8 = GeoArray(np.random.randint(1, 10000, (50, 50, 7), dtype=np.int16)) # no band 9, no pan
# cls.testArr_L8 = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-8__OLI_TIRS__LC81940242014072LGN00_L2B__250x250.bsq') # no pan
# cls.testArr_L8 = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-8__OLI_TIRS__LC81940242014072LGN00_L2B.bsq') # no pan
cls.testArr_L8 = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-8__OLI_TIRS__LC81940242014072LGN00_L2B.bsq') # no pan
# cls.cwl_L8 = [442.98, 482.59, 561.33, 654.61, 864.57, 1609.09, 2201.25]
cls.cwl_L8 = [442.98, 482.59, 561.33, 654.61, 864.57, 1373.48, 1609.09, 2201.25]
......@@ -371,8 +371,8 @@ class Test_SpectralHomogenizer(unittest.TestCase):
class Test_SAM_Classifier(unittest.TestCase):
def test_classify(self):
from gms_preprocessing.algorithms.L2B_P import SAM_Classifier
def test_classify_old(self):
from gms_preprocessing.algorithms.L2B_P import SAM_Classifier_old
gA = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-7__ETM+__LE71920242016104NSG00_image_data_L1A.bsq')
with open('/home/gfz-fe/scheffler/temp/SPECHOM_py/QR__Landsat-7__ETM+__clust50.dill', 'rb') as inF:
......@@ -381,8 +381,24 @@ class Test_SAM_Classifier(unittest.TestCase):
np.array([cc.cluster_center
for cc in undilled['1__2__3__4__5__7'][('Landsat-5', 'TM')]['1__2__3__4__5__7'].values()])
SC = SAM_Classifier()
SC = SAM_Classifier_old()
sub = gA[4465:4470, 4495:4500].astype(np.int16)
# sub[sub==-9999] = 10000
cmap = SC.classify(sub, cluster_centers, nodataVal=-9999)
cmap
def test_classify(self):
from gms_preprocessing.algorithms.L2B_P import SAM_Classifier
gA = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-7__ETM+__LE71920242016104NSG00_image_data_L1A.bsq')
with open('/home/gfz-fe/scheffler/temp/SPECHOM_py/QR_clust50__Landsat-7__ETM+.dill', 'rb') as inF:
undilled = dill.load(inF)
cluster_centers = \
np.array([cc.cluster_center
for cc in undilled['1__2__3__4__5__7'][('Landsat-5', 'TM')]['1__2__3__4__5__7'].values()])
sub = gA[4465:4470, 4495:4500].astype(np.int16)
# sub[sub==-9999] = 10000
SC = SAM_Classifier(cluster_centers)
cmap = SC.classify(sub, nodataVal=-9999)
cmap
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