This tool can be used to change the data type of a raster image. The data type affects the storage requirements of the data file on disk. Internally, Whitebox tools treat all data as doubles (double-precision decimal values) when held in computer memory for data manipulation.
The user must specify the input and output (optional) file names, and the desired data type. Data Type can be either 'double', 'float', or 'integer. The double and float data types are used to represent numerical data containing decimal values; the integer data type is used to represent whole number values that range from -32,768 to 32,767. Each grid cell in a raster image requires 8 bytes to store data as double, 4 bytes to store as a float data type, and 2 bytes for storage as an integer data type.
Notice that the NoData value can only be stored using the float and integer data types. If your raster contains these values, it should be stored using either of these two data types. When converting a file from the float data type to one of the other two types, if a value is encountered in the input image that falls outside the range of possible values, it will be assigned either the NoData value (integer data type) or zero (byte data type) in the output image.
If an output file name is not specified, the tool will overwrite the input image. A temporary image will be created and deleted during this process.
The following is an example of a Python script using this tool:
wd = pluginHost.getWorkingDirectory()
# You may have multiple input files but they must
# be separated by semicolons in the string.
inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
outputFileSuffix = "_new"
dataType = "float"
args = [inputFiles, outputFileSuffix, dataType]
pluginHost.runPlugin("ChangeDataType", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
// You may have multiple input files but they must
// be separated by semicolons in the string.
def inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
def outputFileSuffix = "_new"
def dataType = "integer"
String args = [inputFiles, outputFileSuffix, dataType]
pluginHost.runPlugin("ChangeDataType", args, false)