Hello! While working on the scp_8:accuracy processing script, I identified three major issues that prevent it from working properly.
Issue 1: The layer type of the reference parameter is not properly identified
In this image, I want to pass a vector as the reference.

I get the following error:
It is referring to this part of the code:
Since I did not provide a raster reference, the first if statement should be run and the else statement ignored, and yet that is not the case. The reason for that is that when a raster is not given, reference = '', not reference = None. Therefore, the script runs the raster code block even if only a vector is given, breaking the code.
Issue 2: Current usage of the 'Reference vector' parameter is not supported by rs.cross_classification
Please take a look at the following example:
I have a vector file train.gpkg. If I pass it to the Reference Vector parameter as a file path:
Internally, the variable reference (shown in the third image on line 124) is the following: C:/Users/User/Downloads/train.gpkg. This is a valid value for the rs.cross_classification function.
If I have train.gpkg as a layer named train_data:
Internally, the variable reference will be the layer identifier: train_data_41209414_96e1_4653_8873_e01a72c9c581. Passing this to rs.cross_classification breaks the function. A potential solution is to force the user to choose a file path, since I am unsure why this format breaks the function.
Issue 3: output_path is taken as a directory path rather than a file path
According to the documentation of rs.cross_classification, the output_path parameter refers to the output path for the classification raster:
Despite this fact, the processing script asks for a directory path:
This is misleading. Rather than the output raster and output csv being inside the Downloads folder, the output paths will actually be C:\Users\User\Downloads.tif and C:\Users\User\Downloads.csv respectively. A direct solution would be to replace the QgsProcessingParameterFolderDestination parameter to a QgsProcessingParameterFileDestination.
I can confirm all these fixes work on my machine. If you agree with any of these fixes, I would love to properly contribute to the GitHub repo. Please let me know if I should.
Hello! While working on the scp_8:accuracy processing script, I identified three major issues that prevent it from working properly.
Issue 1: The layer type of the
referenceparameter is not properly identifiedIn this image, I want to pass a vector as the reference.

I get the following error:
It is referring to this part of the code:
Since I did not provide a raster reference, the first if statement should be run and the else statement ignored, and yet that is not the case. The reason for that is that when a raster is not given,
reference = '', notreference = None. Therefore, the script runs the raster code block even if only a vector is given, breaking the code.Issue 2: Current usage of the 'Reference vector' parameter is not supported by
rs.cross_classificationPlease take a look at the following example:
I have a vector file
train.gpkg. If I pass it to the Reference Vector parameter as a file path:Internally, the variable
reference(shown in the third image on line 124) is the following:C:/Users/User/Downloads/train.gpkg. This is a valid value for thers.cross_classificationfunction.If I have
train.gpkgas a layer namedtrain_data:Internally, the variable
referencewill be the layer identifier:train_data_41209414_96e1_4653_8873_e01a72c9c581. Passing this tors.cross_classificationbreaks the function. A potential solution is to force the user to choose a file path, since I am unsure why this format breaks the function.Issue 3:
output_pathis taken as a directory path rather than a file pathAccording to the documentation of
rs.cross_classification, theoutput_pathparameter refers to the output path for the classification raster:Despite this fact, the processing script asks for a directory path:
This is misleading. Rather than the output raster and output csv being inside the Downloads folder, the output paths will actually be
C:\Users\User\Downloads.tifandC:\Users\User\Downloads.csvrespectively. A direct solution would be to replace theQgsProcessingParameterFolderDestinationparameter to aQgsProcessingParameterFileDestination.I can confirm all these fixes work on my machine. If you agree with any of these fixes, I would love to properly contribute to the GitHub repo. Please let me know if I should.