Hi Adam,
I hope your work-around did what you needed. I actually worked with a python coder who created the following script. This worked perfect and gave me my needed values in a stand-alone csv file. Hope it works for you.
-Kelly
import os
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True
# Obtain a license for the ArcGIS 3D Analyst extension
arcpy.CheckOutExtension('3D')
# Set local variables
outLocation = r"C:\Users\Desktop\Topographic_shade\Topographic_shade"
inputDataLocation = r"C:\Users\Desktop\Topographic_shade\Topographic_shade"
points = "DR_CenterLine_Dissolve_pointsZ2Da_elev3Dt.shp"
lines = "DR_CenterLine_Dissolve_pointsZ2Da_elev3D_skyline_originalDEMb.shp"
pointsFile = os.path.join(inputDataLocation, points)
linesFile = os.path.join(inputDataLocation, lines)
# Set environment settings
env.workspace = outLocation
# Process: Create the empty table
outputFName = os.path.join(outLocation, "Shade_original_DEM.csv")
outputFile = open(outputFName, "w")
outputFile.write("ID,PercentOpenSky,PercentShade,MeanHorizAng,MeanZenithAng\n")
fcCursor = arcpy.SearchCursor(pointsFile)
for row in fcCursor:
print(row)
#create a temp shapefile with just one of our points
whereClause = '"FID" = ' + str(row.FID)
tmpSinglePointShp = os.path.join(outLocation, str(row.FID) + ".shp")
arcpy.Select_analysis(pointsFile, tmpSinglePointShp, whereClause)
tmpSingleLineShp = os.path.join(outLocation, "sky" + str(row.FID) + ".shp")
arcpy.Select_analysis(linesFile, tmpSingleLineShp, whereClause)
skyCursor = arcpy.SearchCursor(tmpSingleLineShp, "", "", "Length", "")
for rows in skyCursor:
value = rows.getValue("Length")
if value == 0:
answerPercent = "NA"
Shade = "NA"
aveHoriz = "NA"
aveZenith = "NA"
outputFile.write(str(row.FID) + "," + str(answerPercent) + "," + str(Shade) + "," + str(aveHoriz) + "," + str(aveZenith) + "\n")
arcpy.Delete_management(tmpSinglePointShp)
arcpy.Delete_management(tmpSingleLineShp)
print(str(row.FID) + "," + str(answerPercent) + "," + str(Shade) + "," + str(aveHoriz) + "," + str(aveZenith) + "\n")
else:
#run the skylineGraph on temp output file
tmpSinglePointOutTbl = os.path.join(outLocation, "t" + str(row.FID) + ".dbf")
arcpy.SkylineGraph_3d(tmpSinglePointShp, tmpSingleLineShp, 0, "ADDITIONAL_FIELDS", tmpSinglePointOutTbl)
#manually calculate the average of the two fields we are interested in
count = 0
horizAngSum = 0
zenithAngSum = 0
for outputRow in arcpy.SearchCursor(tmpSinglePointOutTbl):
horizAngSum += outputRow.HORIZ_ANG
zenithAngSum += outputRow.ZENITH_ANG
count += 1
aveHoriz = horizAngSum / count
aveZenith = zenithAngSum / count
#this next section parses out their printed output and stores the 'Percent of sky in our CSV'
msgText = arcpy.GetMessages()
for line in msgText.split("\n"):
if line.startswith("Percent of sky visible above a base vertical angle"):
answerPercent = line.split()[-1][:-1]
Shade = 100 - float(answerPercent)
#write out the calculated answers to our CSV
#outputFile.write(str(row.FID) + "," + str(answerPercent) + "," + str(aveHoriz) + "," + str(aveZenith) + "\n")
outputFile.write(str(row.FID) + "," + str(answerPercent) + "," + str(Shade) + "," + str(aveHoriz) + "," + str(aveZenith) + "\n")
arcpy.Delete_management(tmpSinglePointShp)
arcpy.Delete_management(tmpSingleLineShp)
arcpy.Delete_management(tmpSinglePointOutTbl)
#print(str(row.FID) + "," + str(answerPercent) + "," + str(aveHoriz) + "," + str(aveZenith) + "\n")
print(str(row.FID) + "," + str(answerPercent) + "," + str(Shade) + "," + str(aveHoriz) + "," + str(aveZenith) + "\n")
outputFile.close()