Dear all,
I have a similar problem, I am trying to automatically process some shapefiles in order to use cokriging.
This is the python code:
# Import arcpy module
import arcpy
# Check out any necessary licenses
arcpy.CheckOutExtension("GeoStats")
arcpy.env.overwriteOutput = True
# Local variables:
#CoKriging = "C:\\Users\\nkondapalli\\Desktop\NewFolder\\CoKriging.lyr"
CoKriging = "C:\\Users\\nkondapalli\\Desktop\NewFolder\\Krigingmodel2_2.xml"
TR1intermediate_point = "C:\\Users\\nkondapalli\\Desktop\NewFolder\\TR1intermediate_point.shp"
GACreateGeostatisticalLayer1 = "C:\\Users\\nkondapalli\\Desktop\NewFolder\\GACreateGeostatisticalLayer5"
#GALayerToPoints2 = "C:\\Users\\nkondapalli\\Documents\\ArcGIS\\Default.gdb\\GALayerToPoints5"
GALayerToGri2 = "C:\\Users\\nkondapalli\\Desktop\NewFolder\\GALayerToGri2"
GALayerToPoints2_PointToRast = "C:\\Users\\nkondapalli\\Documents\\ArcGIS\\Default.gdb\\GALayerToPoints5_PointToRast"
test2ASCII_TXT = "C:\\Users\\nkondapalli\\Desktop\NewFolder\\"#test2ASCII.TXT"
numFiles=5
# Process: Create Geostatistical Layer
for i in range(2,3):#numFiles+1):
print "C:\\Users\\nkondapalli\\Desktop\NewFolder\\RG1intermediate_point_%d.shp X=Shape Y=Shape F1=DATA;C:\\Users\\nkondapalli\\Desktop\NewFolder\\TR1intermediate_point_%d.shp X=Shape Y=Shape F1=DATA"%(i,i)
arcpy.GACreateGeostatisticalLayer_ga(CoKriging, "C:\\Users\\nkondapalli\\Desktop\NewFolder\\RG1intermediate_point_%d.shp X=Shape Y=Shape F1=DATA;C:\\Users\\nkondapalli\\Desktop\NewFolder\\TR1intermediate_point_%d.shp X=Shape Y=Shape F1=DATA"%(i,i), GACreateGeostatisticalLayer1)
# Process: GA Layer To Points
#arcpy.GALayerToPoints_ga(GACreateGeostatisticalLayer1, TR1intermediate_point, "", GALayerToPoints2)
# Process: GA Layer To Grid
arcpy.GALayerToGrid_ga(CoKriging, GALayerToGri2, "0.063", "1", "1")
# Process: Point to Raster
#arcpy.PointToRaster_conversion(GALayerToPoints2, "OBJECTID", GALayerToPoints2_PointToRast, "MOST_FREQUENT", "NONE", "0.05")
# Process: Raster to ASCII
print 'print to file : '+'file%d.txt'%i
arcpy.RasterToASCII_conversion(GALayerToGri2, test2ASCII_TXT+"file%d.txt"%i)
and this is the error:
C:\Users\nkondapalli\Desktop\NewFolder\RG1intermediate_point_2.shp X=Shape Y=Shape F1=DATA;C:\Users\nkondapalli\Desktop\NewFolder\TR1intermediate_point_2.shp X=Shape Y=Shape F1=DATA
Traceback (most recent call last):
File "C:\Users\nkondapalli\Desktop\NewFolder\testErik3.py", line 36, in <module>
arcpy.GALayerToGrid_ga(CoKriging, GALayerToGri2, "0.063", "1", "1")
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\ga.py", line 1341, in GALayerToGrid
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input geostatistical layer: Dataset C:\Users\nkondapalli\Desktop\NewFolder\Krigingmodel2_1.xml does not exist or is not supported
WARNING 000725: Output surface raster: Dataset C:\Users\nkondapalli\Desktop\NewFolder\GALayerToGri2 already exists.
Failed to execute (GALayerToGrid).
It looks like the error is in the xml file. We actually modified it, inserting optimize = "ByCrossvalidation" and changing the options auto to "true".
Any clue?
Thanks!
Michele