CutOut¶
Keeps only the cells of a raster inside a mask, or within a range of values, setting all the others to no-data. With doInverse the mask is inverted: the cells inside it are removed.
Parameters¶
Masks a raster with another raster, or with thresholds on its values: the cells outside the mask, or outside the range of the thresholds, become no-data.
Toolbox folder: Raster Processing
Status: Certified
Keywords: Raster, Mask, Threshold
Authors: Silvia Franceschi, Andrea Antonello
Class: org.hortonmachine.modules.CutOut
Inputs
Parameter |
Type |
Unit |
Default |
Description |
|---|---|---|---|---|
|
raster file |
The map that has to be processed. |
||
|
raster file |
The map to use as mask. |
||
|
Double |
The upper threshold value. |
||
|
Double |
The lower threshold value. |
||
|
boolean |
|
Switch for doing extraction of the mask area or the inverse (negative). Default is false and extract the mask area. |
Outputs
Parameter |
Type |
Unit |
Description |
|---|---|---|---|
|
output file |
The processed map. |
Example¶
The example runs on the sample elevation model of the manual, dtm_flanginec.tif in docs/manual/modules/maps/data, each module on the outputs of the previous ones:
import org.hortonmachine.modules.CutOut
// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"
// keep the drainage directions and the network only inside the basin
for (name in ["drain", "net"]) {
var cutOut = new CutOut()
cutOut.inRaster = folder + name + ".tif"
cutOut.inMask = folder + "basin.tif"
cutOut.outRaster = folder + name + "_basin.tif"
cutOut.process()
}
The drainage directions of DrainDir, kept only inside the basin of ExtractBasin.¶