Hi,
I am trying to perform spatial interpolation for a few set of points. I have 17 shapefiles and I need to do kriging for each of them. I tried to do it using the following code. The code is working and it saves the raster files but it looks like it has a problem because when I try to open the output using Arcmap, it gives me an error. I also have used numpy to read the raster output and it was just one number. Would you please help me with that?
import arcpy
from arcpy import env
from arcpy.sa import *
import os
# Specify your environment
arcpy.env.workspace = r"C:\Users\...."
filess = 'C:/Users/Desktop/python code/points'
point_file_list = [ ]
for file in os.listdir(filess):
if ".shp" in file:
point_file_list.append(file)
path_list = [ ]
for points in point_file_list:
inFeatures = os.path.join(filess,points)
field = 'dro'
cellSize = 12500
outRaster = os.path.join("C:/Users/Desktop/python code/rasters")
lagSize = 2000
majorRange = 2.6
partialSill = 542
nugget = 0
kModelOrdinary = KrigingModelOrdinary("CIRCULAR", lagSize, majorRange, partialSill, nugget)
kRadius = RadiusFixed(20000, 1)
outKriging = Kriging(inFeatures, field, kModelOrdinary, cellSize, kRadius)
path_list.append(outRaster)
tifname = points[-10:]
kriging_OUT= os.path.join(outRaster, 'r{0}.tif'.format(tifname))
outKriging.save(kriging_OUT)