import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outBooleanNot = BooleanNot("degs")
outBooleanNot.save("C:/sapyexamples/output/outboolnot.tif")
BooleanNot 示例 2(独立脚本)
本例对 Grid 栅格执行“布尔非”(求反)运算。
# Name: BooleanNot_Ex_02.py
# Description: Performs a Boolean complement (NOT) operation on the
# cell values of an input raster
# Requirements: Spatial Analyst extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster = "degs"
# Run BooleanNot
outBooleanNot = BooleanNot(inRaster)
# Save the output
outBooleanNot.save("C:/sapyexamples/output/outboolnot")