| pktools 2.6.7 Processing Kernel for geospatial data

Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qgis.pksetmask.pksetmask Class Reference
Inheritance diagram for qgis.pksetmask.pksetmask:
[legend]
Collaboration diagram for qgis.pksetmask.pksetmask:
[legend]

## Public Member Functions
def | cliName (self)
def | defineCharacteristics (self)
def | processAlgorithm (self, progress)
Public Member Functions inherited from qgis.pktoolsAlgorithm.pktoolsAlgorithm
def | getIcon (self)
def | checkBeforeOpeningParametersDialog (self)
def | help (self)

## Public Attributes
| name
| group

## Static Public Attributes
string | INPUT = "INPUT"
string | MASK = "MASK"
string | MSKNODATA = "MSKNODATA"
string | MSKBAND = "MSKBAND"
list | OPERATOR_OPTIONS = ["=","<",">","!"]
string | OPERATOR = "OPERATOR"
string | NODATA = "NODATA"
string | OUTPUT = "OUTPUT"
string | RTYPE = 'RTYPE'
list | TYPE = ['none', 'Byte','Int16','UInt16','UInt32','Int32','Float32','Float64','CInt16','CInt32','CFloat32','CFloat64']
string | EXTRA = 'EXTRA'

## Detailed Description

Definition at line 38 of file pksetmask.py.

## Member Function Documentation

## ◆ cliName()

def qgis.pksetmask.pksetmask.cliName | ( |  | self | ) |

Definition at line 52 of file pksetmask.py.

52 def cliName(self):
53 return "pksetmask"
54

## ◆ defineCharacteristics()

def qgis.pksetmask.pksetmask.defineCharacteristics | ( |  | self | ) |

Definition at line 55 of file pksetmask.py.

55 def defineCharacteristics(self):
56 self.name = "apply mask to raster dataset"
57 self.group = "[pktools] raster"
58 self.addParameter(ParameterRaster(self.INPUT, 'Input layer raster data set',ParameterRaster))
59 self.addParameter(ParameterMultipleInput(self.MASK, 'Mask(s) to apply',ParameterMultipleInput.TYPE_RASTER))
60 self.addParameter(ParameterString(self.MSKNODATA, "Mask value(s), provide value for each mask (e.g., 250;255)","1"))
61 self.addParameter(ParameterString(self.MSKBAND, "Mask band(s) to read, provide band for each mask (e.g., 0;1)","0"))
62 self.addParameter(ParameterSelection(self.OPERATOR,"setmask rule",self.OPERATOR_OPTIONS, 0))
63 self.addParameter(ParameterString(self.NODATA, "nodata value to put in image if not valid","0"))
64 self.addOutput(OutputRaster(self.OUTPUT, "Output raster data set"))
65 self.addParameter(ParameterSelection(self.RTYPE, 'Output raster type (leave as none to keep original type)', self.TYPE, 0))
66 self.addParameter(ParameterString(self.EXTRA,
67 'Additional parameters', '-of GTiff', optional=True))
68

## ◆ processAlgorithm()

def qgis.pksetmask.pksetmask.processAlgorithm | ( |  | self,
|  |  | progress
| ) |  |

Definition at line 69 of file pksetmask.py.

69 def processAlgorithm(self, progress):
70 cliPath = '"' + os.path.join(pktoolsUtils.pktoolsPath(), self.cliName()) + '"'
71 commands = [cliPath]
72
73 input=self.getParameterValue(self.INPUT)
74 commands.append('-i')
75 commands.append('"' + input + '"')
76
77 mask=self.getParameterValue(self.MASK)
78 maskFiles = mask.split(';')
79 for maskFile in maskFiles:
80 commands.append('-m')
81 commands.append(maskFile)
82
83 commands.append(str(self.getParameterValue(self.MSKBAND)))
84 mskband=self.getParameterValue(self.MSKBAND)
85 mskbandValues = mskband.split(';')
86 for mskbandValue in mskbandValues:
87 commands.append('-mskband')
88 commands.append(mskbandValue)
89 commands.append(str(self.getParameterValue(self.MSKNODATA)))
90 msknodata=self.getParameterValue(self.MSKNODATA)
91 msknodataValues = msknodata.split(';')
92 for msknodataValue in msknodataValues:
93 commands.append('-msknodata')
94 commands.append(msknodataValue)
95
96 commands.append("-p")
97 commands.append(self.OPERATOR_OPTIONS[self.getParameterValue(self.OPERATOR)])
98 nodata=self.getParameterValue(self.NODATA)
99 commands.append('-nodata')
100 commands.append(nodata)
101 if self.TYPE[self.getParameterValue(self.RTYPE)] != "none":
102 commands.append('-ot')
103 commands.append(self.TYPE[self.getParameterValue(self.RTYPE)])
104 output=self.getOutputValue(self.OUTPUT)
105 if output != "":
106 commands.append("-o")
107 commands.append('"' + output + '"')
108
109 extra = str(self.getParameterValue(self.EXTRA))
110 if len(extra) > 0:
111 commands.append(extra)
112
113 pktoolsUtils.runpktools(commands, progress)

## Member Data Documentation

## ◆ EXTRA

string qgis.pksetmask.pksetmask.EXTRA = 'EXTRA'
| static

Definition at line 50 of file pksetmask.py.

## ◆ group

qgis.pksetmask.pksetmask.group

Definition at line 57 of file pksetmask.py.

## ◆ INPUT

string qgis.pksetmask.pksetmask.INPUT = "INPUT"
| static

Definition at line 40 of file pksetmask.py.

## ◆ MASK

string qgis.pksetmask.pksetmask.MASK = "MASK"
| static

Definition at line 41 of file pksetmask.py.

## ◆ MSKBAND

string qgis.pksetmask.pksetmask.MSKBAND = "MSKBAND"
| static

Definition at line 43 of file pksetmask.py.

## ◆ MSKNODATA

string qgis.pksetmask.pksetmask.MSKNODATA = "MSKNODATA"
| static

Definition at line 42 of file pksetmask.py.

## ◆ name

qgis.pksetmask.pksetmask.name

Definition at line 56 of file pksetmask.py.

## ◆ NODATA

string qgis.pksetmask.pksetmask.NODATA = "NODATA"
| static

Definition at line 46 of file pksetmask.py.

## ◆ OPERATOR

string qgis.pksetmask.pksetmask.OPERATOR = "OPERATOR"
| static

Definition at line 45 of file pksetmask.py.

## ◆ OPERATOR_OPTIONS

list qgis.pksetmask.pksetmask.OPERATOR_OPTIONS = ["=","<",">","!"]
| static

Definition at line 44 of file pksetmask.py.

## ◆ OUTPUT

string qgis.pksetmask.pksetmask.OUTPUT = "OUTPUT"
| static

Definition at line 47 of file pksetmask.py.

## ◆ RTYPE

string qgis.pksetmask.pksetmask.RTYPE = 'RTYPE'
| static

Definition at line 48 of file pksetmask.py.

## ◆ TYPE

list qgis.pksetmask.pksetmask.TYPE = ['none', 'Byte','Int16','UInt16','UInt32','Int32','Float32','Float64','CInt16','CInt32','CFloat32','CFloat64']
| static

Definition at line 49 of file pksetmask.py.

The documentation for this class was generated from the following file:

- /tmp/slackdce/slackrepo.NvCr9x/build_pktools/PKTOOLS-2.6.7.6/qgis/pksetmask.py