设置模型参数 (地统计分析)
摘要
在现有的地统计模型源中设置参数值。
用法
-
此工具通常用于模型或脚本中。
-
地统计模型源为地统计图层或地统计模型 (XML)。
-
下例可用于在参数 XML 路径中指定要设置为新值的参数。
/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'NumberOfLags'] - to change the number of lags parameter
/model[@name = 'LPI']/value[@name = 'Weight'] - to change the weight parameter for LPI
/model[@name = "Kriging"]/model[@name = "Variogram"]/value[@name = "Nugget"]/@auto - then specify a true or false value (true implies that a new nugget value will be calculated when the XML file is used).
/model[@name = 'Kriging']/model[@name = 'Variogram']/model[@name = 'VariogramModel']/value[@name = 'Range']/@auto - then specify a true or false value (true implies that a new range value will be calculated when the XML file is used).
/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Nugget'] - then specify a new nugget value.
-
下面的代码片段可通过对该工具的一次调用设置多个参数。
params = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Nugget']/@auto;\ /model[@name = 'Kriging']/model[@name = 'Variogram']/model[@name = 'VariogramModel']/value[@name = 'Range'];\ /model[@name = 'Kriging']/model[@name = 'Variogram']/model[@name = 'VariogramModel']/value[@name = 'Sill']" vals = "true;5.5;777" gp.GASetModelParameter_ga(inXMLFile, params, vals, outXMLFile)
语法
GASetModelParameter_ga (in_ga_model_source, model_param_xpath, in_param_value, out_ga_model)
参数 | 说明 | 数据类型 |
in_ga_model_source |
要分析的地统计模型源。 | File; Geostatistical Layer |
model_param_xpath |
所需模型参数的 XML 路径。 | String |
in_param_value |
由 XML 路径定义的参数值。 | String |
out_ga_model |
利用在 XML 路径中定义的参数值创建的地统计模型。 | File |
代码实例
SetModelParameter 示例 1(Python 窗口)
更改地统计模型源中的参数值。
import arcpy
from arcpy import env
env.workspace = "C:/gapyexamples/data"
newParam = arcpy.GASetModelParameter_ga(
"C:/gapyexamples/data/kriging.lyr",
"/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Nugget']",
"1", "C:/gapyexamples/output/outModel.xml")
print newParam
SetModelParameter 示例 2(独立脚本)
更改地统计模型源中的参数值。
# Name: GASetModelParameter_Example_02.py
# Description: Sets parameter value in an existing geostatistical model source.
# Requirements: Geostatistical Analyst Extension
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/gapyexamples/data"
# Set local variables
modelSource = "C:/gapyexamples/data/kriging.lyr"
xmlPath = "/model[@name = 'Kriging']/model[@name = 'Variogram']/value[@name = 'Nugget']"
newValue = 1
outModel = "C:/gapyexamples/output/outModel.xml"
# Check out the ArcGIS Geostatistical Analyst extension license
arcpy.CheckOutExtension("GeoStats")
# Execute GASetModelParameter
newParam = arcpy.GASetModelParameter_ga(modelSource, xmlPath, newValue, outModel)
# Show results
print newParam
环境
此工具不使用任何地理处理环境
相关主题
许可信息
ArcGIS for Desktop Basic:需要 Geostatistical Analyst
ArcGIS for Desktop Standard:需要 Geostatistical Analyst
ArcGIS for Desktop Advanced:需要 Geostatistical Analyst
9/15/2013