Class: QgsNineCellFilter¶
- class qgis.analysis.QgsNineCellFilter¶
Bases:
sip.wrapper
Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of each cell based on the cell value and the eight neighbour cells.
Common examples are slope and aspect calculation in DEMs. Subclasses only implement the method that calculates the new value from the nine values. Everything else (reading file, writing file) is done by this subclass
QgsNineCellFilter(inputFile: str, outputFile: str, outputFormat: str) Constructor that takes input file, output file and output format (GDAL string)
QgsNineCellFilter(
QgsNineCellFilter
)Methods
- rtype:
float
- rtype:
float
- rtype:
float
- rtype:
float
Calculates output value from nine input values.
Starts the calculation, reads from mInputFile and stores the result in mOutputFile
- param size:
- param size:
- param value:
- param value:
- param factor:
- rtype:
float
- cellSizeX(self) float ¶
- Return type:
float
- cellSizeY(self) float ¶
- Return type:
float
- inputNodataValue(self) float ¶
- Return type:
float
- outputNodataValue(self) float ¶
- Return type:
float
- processNineCellWindow(self) Tuple[float, float, float, float, float, float, float, float, float, float] ¶
Calculates output value from nine input values. The input values and the output value can be equal to the nodata value if not present or outside of the border. Must be implemented by subclasses.
First index of the input cell is the row, second index is the column
- Parameters:
x11 – surrounding cell top left
x21 – surrounding cell central left
x31 – surrounding cell bottom left
x12 – surrounding cell top central
x22 – the central cell for which the value will be calculated
x32 – surrounding cell bottom central
x13 – surrounding cell top right
x23 – surrounding cell central right
x33 – surrounding cell bottom right
- Return type:
Tuple[float, float, float, float, float, float, float, float, float, float]
- Returns:
the calculated cell value for the central cell x22
- processRaster(self, feedback: QgsFeedback = None) int ¶
Starts the calculation, reads from mInputFile and stores the result in mOutputFile
- Parameters:
feedback (
QgsFeedback
= None) – feedback object that receives update and that is checked for cancellation.- Return type:
int
- Returns:
0 in case of success
- setCellSizeX(self, size: float)¶
- Parameters:
size (float) –
- setCellSizeY(self, size: float)¶
- Parameters:
size (float) –
- setInputNodataValue(self, value: float)¶
- Parameters:
value (float) –
- setOutputNodataValue(self, value: float)¶
- Parameters:
value (float) –
- setZFactor(self, factor: float)¶
- Parameters:
factor (float) –
- zFactor(self) float ¶
- Return type:
float