I have one shapefile that contains many fields and I'd like to write a simple script tool that allows me to run IDW for the fields I select. Is this possible?
For example.....
Input: 1 shapefile
Sample field1 field2 field3 field4 .....
1 26.5 27.5 22.2 32.3
2 19.1 12.2 45.3 33.3
3 11.1 15.6 44.4 34.4
Options:
field 1 ☑
field 2 ☑
field 3 ☑ .....
Output: field1_IDW, field2_IDW, field3_IDW .....
EDIT: The following code works properly
# Import arcpy module
import arcpy
from arcpy import env
from arcpy.sa import *
# Check out any necessary licenses
arcpy.CheckOutExtension("Spatial")
inPointFeatures = arcpy.GetParameterAsText(0)
fieldList = arcpy.GetParameterAsText(1)
# Define local variables
cellSize = 250.0
power = 2
searchRadius = RadiusVariable(12)
for fieldName in fieldList.split(';'):
outIDW = Idw(inPointFeatures, fieldName, cellSize, power, searchRadius)
# Save the output
outIDW.save("C:/temp/idwout_{0}.tif".format(fieldName))