I'm very thankful for the example script provided below from the help menu. Especially the inclusion of a range for the plane input. However, I cannot for the life of me, figure out how to write all of the results to one .txt or .csv. When I include an output = 'c:/data/example.csv' and then specify the output variable in result = arcpy.SurfaceVolume_3d(inSurface, output, "ABOVE", plane, z_factor, pyramid_level), it only writes the first result to the file. In ArcObjects I believe the method is called writestream or writeline. Is there something similar in python?
Thanks,
Mike
# Name: Surface Volume Example
# Description: The following stand-alone script demonstrates how to use the
# Surface Volume tool to determine the area and volume of a
# TIN dataset using planes of 100, 200, and 300 feet.
#
# Requirements: 3D Analyst extension
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
# Obtain a license for the 3D Analyst extension
arcpy.CheckOutExtension("3D")
# Set environment settings
env.workspace = "C:/data"
try:
# Set Local Variables
inSurface = "sample.gdb/featuredataset/elevation_terrain"
z_factor = 3.28
pyramid_level = 5
for plane in range(100, 301, 100):
#Execute SurfaceVolume
result = arcpy.SurfaceVolume_3d(inSurface, "", "ABOVE", plane,
z_factor, pyramid_level)
print result.GetMessage(0)
except Exception as e:
# Returns any other error messages
print e.message