Commit 0a5df2db authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Intermediate state of bugfix.

parent b7565aaa
Pipeline #3177 failed with stage
in 18 minutes and 10 seconds
......@@ -1572,9 +1572,19 @@ class RSImage_ClusterPredictor(object):
:param nodataVal: no data value of the input image (ignored if image is a GeoArray with existing nodata value)
:param CPUs: CPUs to use (default: 1)
:return: 3D array representing the predicted spectral image cube
FIXME:
Wichtig, dass hier der richtige nodata value in image.nodata drin steht.
Beachten:
- image.nodata = image.nodata if image._nodata is not None else nodataVal:
soll nodata value NUR dann benutzt werden, wenn sich der nodata value nicht automatisch berechnen lässt?
- classify_image schreibt nodataVal dort in den output wo image.nodata drin steht
- predict überspringt sp#ter die postionen, wo nodataval in classif_map steht
-
"""
image = image if isinstance(image, GeoArray) else GeoArray(image, nodata=nodataVal)
image.nodata = image.nodata if image.nodata is not None else nodataVal
image.nodata = image.nodata if image.nodata is not None else nodataVal # TODO: validate that
# assign each input pixel to a cluster (compute classfication with cluster centers as endmembers)
if not self.classif_map:
......@@ -1585,7 +1595,7 @@ class RSImage_ClusterPredictor(object):
classifier.cluster_pixVals,
classif_alg=self.classif_alg,
kNN_n_neighbors=self.kNN_n_neighbors,
nodataVal=nodataVal,
nodataVal=nodataVal, # written into classif_map at nodata pixels
CPUs=self.CPUs)
print('Total classification time: %s' % time.strftime("%H:%M:%S", time.gmtime(time.time() - t0)))
else:
......@@ -1646,7 +1656,7 @@ class RSImage_ClusterPredictor(object):
raise ValueError('The given classifier contains error statistics incompatible to the shape of the '
'image.')
if self.classif_map is None:
raise RuntimeError('self.classif_map must be generated by running self.classify_image() beforehand.')
raise RuntimeError('self.classif_map must be generated by running self.predict() beforehand.')
errors = np.empty_like(im_predicted)
......
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