Unexpected Error Transform Raster & InverseTransform Raster

Issue #862 resolved
Royden Yates created an issue

QGIS version: 3.23.0-Master
QGIS code revision: 8e46f2ca6a
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.2.2
GEOS version: 3.9.0-CAPI-1.16.2
PROJ version: Rel. 7.2.1, January 1st, 2021
PDAL version: 2.2.0 (git-version: Release)

OS Version: Ubuntu 21.04

EnMAP-Box Version 3.9.20211029T103015.master

I checked that the dependencies are met as well as met for versions

Load Example Data : enmap_berlin.bsq & hires_berlin.bsq

Transformation --> Fit PCA is Successful. .pkl files output in both cases.

Transformation → Transform Raster with .pkl from previous fails for hires_berlin.bsq but succeeds for enmap_berlin.bsq

Algorithm started at: 2021-11-22T19:47:22
Algorithm 'Transform Raster' starting…
Input parameters:
{ 'mask' : None, 'outRaster' : 'TEMPORARY_OUTPUT', 'raster' : '/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/exampledata/hires_berlin.bsq', 'transformer' : '/home/royden/Pictures/temporary_enhancement/PCA_temp_hires.pkl' }

start EstimatorTransform, RasterSize(x=800, y=3327)
Traceback (most recent call last):
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/provider.py", line 156, in processAlgorithm
result = self.processAlgorithm_()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/algorithms.py", line 697, in processAlgorithm_
estimator.transform(filename=filename, raster=raster, mask=mask, progressBar=self._progressBar)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5305, in _transform
applier.apply(operatorType=_EstimatorTransform, estimator=self, raster=raster, mask=mask, mask2=mask2,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 53, in apply
results = hubdc.applier.Applier.apply(self, operatorType=operatorType, description=description,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 979, in apply
results = self._runProcessSubgrids()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1043, in _runProcessSubgrids
blockResults.append(_Worker.processSubgrid(**kwargs))
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1125, in processSubgrid
return cls.operator._apply(workingGrid=workingGrid, iblock=i, nblock=n, yblock=iy, xblock=ix, nyblock=ny,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1272, in _apply
blockResult = self.ufunc(*self._ufuncArgs, **self._ufuncKwargs)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5426, in ufunc
y = sklTransform(X=X)
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/utils/metaestimators.py", line 113, in <lambda>
out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs) # noqa
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/pipeline.py", line 647, in transform
Xt = transform.transform(Xt)
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/preprocessing/_data.py", line 973, in transform
X = self._validate_data(
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/base.py", line 561, in _validate_data
X = check_array(X, **check_params)
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/utils/validation.py", line 797, in check_array
raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by StandardScaler.

Traceback (most recent call last):
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/provider.py", line 156, in processAlgorithm
result = self.processAlgorithm_()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/algorithms.py", line 697, in processAlgorithm_
estimator.transform(filename=filename, raster=raster, mask=mask, progressBar=self._progressBar)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5305, in _transform
applier.apply(operatorType=_EstimatorTransform, estimator=self, raster=raster, mask=mask, mask2=mask2,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 53, in apply
results = hubdc.applier.Applier.apply(self, operatorType=operatorType, description=description,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 979, in apply
results = self._runProcessSubgrids()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1043, in _runProcessSubgrids
blockResults.append(_Worker.processSubgrid(**kwargs))
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1125, in processSubgrid
return cls.operator._apply(workingGrid=workingGrid, iblock=i, nblock=n, yblock=iy, xblock=ix, nyblock=ny,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1272, in _apply
blockResult = self.ufunc(*self._ufuncArgs, **self._ufuncKwargs)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5426, in ufunc
y = sklTransform(X=X)
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/utils/metaestimators.py", line 113, in <lambda>
out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs) # noqa
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/pipeline.py", line 647, in transform
Xt = transform.transform(Xt)
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/preprocessing/_data.py", line 973, in transform
X = self._validate_data(
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/base.py", line 561, in _validate_data
X = check_array(X, **check_params)
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/utils/validation.py", line 797, in check_array
raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by StandardScaler.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/provider.py", line 170, in processAlgorithm
raise Exception('unexpected error')
Exception: unexpected error

Execution failed after 0.38 seconds

Loading resulting layers
Algorithm 'Transform Raster' finished

Transformation → InverseTransform Raster fails for enmap_berlin-bsq

Algorithm started at: 2021-11-22T18:36:45
Algorithm 'InverseTransform Raster' starting…
Input parameters:
{ 'mask' : None, 'outRaster' : '/home/royden/Pictures/temporary_enhancement/enmap_inverse.tif', 'raster' : '/home/royden/Pictures/temporary_enhancement/enmap.tif', 'transformer' : '/home/royden/Pictures/temporary_enhancement/PCA_temp_enmap.pkl' }

start EstimatorTransform, RasterSize(x=220, y=400)
Traceback (most recent call last):
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/provider.py", line 156, in processAlgorithm
result = self.processAlgorithm_()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/algorithms.py", line 729, in processAlgorithm_
estimator.inverseTransform(filename=filename, raster=raster, mask=mask, progressBar=self._progressBar)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5310, in _inverseTransform
return self._transform(filename=filename, raster=raster, inverse=True, mask=None, mask2=None, **kwargs)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5305, in _transform
applier.apply(operatorType=_EstimatorTransform, estimator=self, raster=raster, mask=mask, mask2=mask2,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 53, in apply
results = hubdc.applier.Applier.apply(self, operatorType=operatorType, description=description,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 979, in apply
results = self._runProcessSubgrids()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1043, in _runProcessSubgrids
blockResults.append(_Worker.processSubgrid(**kwargs))
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1125, in processSubgrid
return cls.operator._apply(workingGrid=workingGrid, iblock=i, nblock=n, yblock=iy, xblock=ix, nyblock=ny,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1272, in _apply
blockResult = self.ufunc(*self._ufuncArgs, **self._ufuncKwargs)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5417, in ufunc
_, noutputs = sklTransform(X=X0).shape
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/utils/metaestimators.py", line 113, in <lambda>
out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs) # noqa
TypeError: inverse_transform() got an unexpected keyword argument 'X'

Traceback (most recent call last):
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/provider.py", line 156, in processAlgorithm
result = self.processAlgorithm_()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/algorithms.py", line 729, in processAlgorithm_
estimator.inverseTransform(filename=filename, raster=raster, mask=mask, progressBar=self._progressBar)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5310, in _inverseTransform
return self._transform(filename=filename, raster=raster, inverse=True, mask=None, mask2=None, **kwargs)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5305, in _transform
applier.apply(operatorType=_EstimatorTransform, estimator=self, raster=raster, mask=mask, mask2=mask2,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 53, in apply
results = hubdc.applier.Applier.apply(self, operatorType=operatorType, description=description,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 979, in apply
results = self._runProcessSubgrids()
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1043, in _runProcessSubgrids
blockResults.append(_Worker.processSubgrid(**kwargs))
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1125, in processSubgrid
return cls.operator._apply(workingGrid=workingGrid, iblock=i, nblock=n, yblock=iy, xblock=ix, nyblock=ny,
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubdc/applier.py", line 1272, in _apply
blockResult = self.ufunc(*self._ufuncArgs, **self._ufuncKwargs)
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/hubflow/core.py", line 5417, in ufunc
_, noutputs = sklTransform(X=X0).shape
File "/home/royden/.local/lib/python3.9/site-packages/sklearn/utils/metaestimators.py", line 113, in <lambda>
out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs) # noqa
TypeError: inverse_transform() got an unexpected keyword argument 'X'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxgeoalgorithms/provider.py", line 170, in processAlgorithm
raise Exception('unexpected error')
Exception: unexpected error

Execution failed after 0.76 seconds

Loading resulting layers
Algorithm 'InverseTransform Raster' finished

Comments (5)

  1. Log in to comment