Arcgis python:参数未更改导致死循环

时间:2016-09-30 10:00:36

标签: python arcgis

需求分析:    我有一个Tin / Terrain文件,我设置了一个初始水位,目标是使用Terrain文件计算这个地方在初始水位下的体积。将体积与实际值进行比较,得到了理想的水位。

工具:    Arcgis 10.1(polygon volume_3D模块)    python 2.7

import arcpy
import os

arcpy.env.workspace = "G:/0arcpy/hjh_split"
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("3D")

fclist = arcpy.ListFeatureClasses()

inSurface = "G:/0arcpy/hjh_tin"
zField = "sswl" 
refPlane = "BELOW" 
sAreaFld = "SArea"
volFld = "Volume" 

for fc in fclist:    
    arcpy.PolygonVolume_3d(inSurface, fc, zField, refPlane, volFld, sAreaFld) 
    rows = arcpy.UpdateCursor(fc) 
    for row in rows:
        i = row.getValue("Volume") 
        j = row.jyvol 
        while ((abs(i-j))/j>0.1) : 
            row.setValue("sswl",row.getValue("sswl")+0.01)
            rows.updateRow(row)
            arcpy.PolygonVolume_3d(inSurface, fc, zField, refPlane, volFld, sAreaFld)
        print "i="+str(i)+"-"+"sswl="+str(row.sswl)           
        print "Finished" 

结果: enter image description here

问题: 水位(sswl)改为加0.01,但i(体积)值不变,导致死循环。但是为什么值i = row.getValue(" Volume")在循环中没有改变。我有什么问题,如何更改代码?

0 个答案:

没有答案