This tool performs the cross classification which is similar to band combination, but it is executed between two files only. The reference file can also be of vector type. A unique value is assigned to each combination of values. The output is a raster made of unique values corresponding to combinations of values. An output text file describes the correspondance between unique values and combinations, as well as the statistics of each combination, with the option to calculate an error matrix or linear regression.
Typical usage example:
>>> # import Remotior Sensus and start the session >>> import remotior_sensus >>> rs = remotior_sensus.Session() >>> # start the process >>> cross = rs.cross_classification(classification_path='file1.tif',reference_path='file2.tif',output_path='output.tif')
- remotior_sensus.tools.cross_classification.cross_classification(classification_path: str, reference_path: str, output_path: None | str = None, overwrite: bool | None = False, vector_field: None | str = None, nodata_value: None | int = None, cross_matrix: bool | None = False, regression_raster: bool | None = False, error_matrix: bool | None = False, extent_list: list | None = None, n_processes: None | int = None, available_ram: None | int = None) OutputManager
Calculation of cross classification.
This tool allows for the cross classification of two files (a classification raster and a reference vector or raster) in order to get a raster where each value corresponds to a combination of class values. Input raster values must be integer type. The output is a cross raster and, depending on the parameters, a text file reporting the statistics of each combination, error matrix, or linear regression statistics.
classification_path – path of raster used as classification input.
reference_path – path of the vector or raster file used as reference input.
vector_field – in case of vector reference, the name of the field used as reference value.
output_path – path of the output raster.
overwrite – if True, output overwrites existing files.
nodata_value – value to be considered as nodata.
cross_matrix – if True then calculate the cross matrix.
regression_raster – if True then calculate linear regression statistics.
error_matrix – if True then calculate error matrix.
extent_list – list of boundary coordinates left top right bottom.
n_processes – number of parallel processes.
available_ram – number of megabytes of RAM available to processes.
paths = [output raster path, output table path]
- Perform the cross classification between two files
>>> cross = cross_classification(classification_path='file1.tif',reference_path='file2.tif',output_path='output.tif')
- Perform the cross classification between two files and calculate the error matrix
>>> cross = cross_classification(classification_path='file1.tif',reference_path='file2.tif',output_path='output.tif',error_matrix=True)