Select to view content in your preferred language

Cannot determine range and sill parameter values from GA model

534
2
07-08-2011 03:47 PM
ChrisBater
Deactivated User
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
0 Kudos
2 Replies
SteveLynch
Esri Regular Contributor
0 Kudos
ChrisBater
Deactivated User
Ah I see. The lines to retrieve the range and sill should have read:

xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/model[@name = 'VariogramModel']/value[@name = 'Range']"
rnge = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)

xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/model[@name = 'VariogramModel']/value[@name = 'Sill']"
sill = arcpy.GAGetModelParameter_ga("outCgLayer", xmlPath)

Thanks for your time,

Chris
0 Kudos