Hi, I am trying to iterate through some feature classes with z-vaues and determine the variogram parameters for each. For each feature class, I create a temporary geostatistical layer using a previously generated model in xml format, then I try to get the nugget, number of lags, lag size, range and sill from the new layer's xml data. Oddly, I am having no problem getting the first three parameters, but then my code fails to retrieve the range and sill.
Any suggestions would be greatly appreciated.
Thanks,
Chris
Here is the code:
#the geodstats model was created manually using the geostatistical analyst wizard
geoStatsModel = r'C:\temp\Kriging2_modified.xml'
#GN1 is a fgdb feature class and 'RASTERVALU' is a field of z values
inData = 'GN1 RASTERVALU'
#create the new geostats layer
arcpy.GACreateGeostatisticalLayer_ga(geoStatsModel, inData, "outCgLayer")
#now get the model parameters
xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Nugget']"
nugget = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)
print 'Nugget: ',nugget
xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'NumberOfLags']"
lags = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)
print 'Number of lags: ', lags
xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'LagSize']"
lagSize = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)
print 'Lag size: ', lagSize
############################################
#code fails here, won't retrieve the range or sill
############################################
xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Range']"
rnge = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)
print 'Range: ', rnge
xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Sill']"
sill = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)
print 'Sill: ', sill