AnsweredAssumed Answered

passing the output of a tool as input to another

Question asked by kostas_ptr88 on Dec 15, 2015
Latest reply on Dec 16, 2015 by GSCUser85

Hello I have the following code (its a bit big but very simple), and the problem I am facing is that I cannot pass the raster rcls to the Create Spatially Balanced tool, unless I add it to Table of Contents (lines 32- 42). I am building a new tool, so I don't want to interrupt the proccess by adding something to the Talbe of Contents, cracking my tool to 2 tools. The "values" and "num_pnts" variable (line 13-14) show the number of points that will be created. Thanks in advance.


import arcpy
import os
from arcpy import env
from import *

#workspace = arcpy.GetParameterAsText(0)
workspace = "C:/Results/ArcMap/Visibility/Calc_View/"

# arithmos simion kai viewsheds
#value = arcpy.GetParameterAsText(1)
values = 2
num_pnts = int(values)

#height_val = arcpy.GetParameterAsText(2)
height_val = 100
height = int(height_val)

#demodel = arcpy.GetParameterAsText(3)
#demMAXResult = arcpy.GetRasterProperties_management(demodel, "MAXIMUM")
#demMAXResult = arcpy.GetRasterProperties_management(demodel, "MINIMUM")
demMAXResult = arcpy.GetRasterProperties_management("C:/Results/ArcMap/Visibility/Calc_View/tin2ras3g_1", "MAXIMUM")
demMINResult = arcpy.GetRasterProperties_management("C:/Results/ArcMap/Visibility/Calc_View/tin2ras3g_1", "MINIMUM")
demMAX = demMAXResult.getOutput(0)
demMIN = demMINResult.getOutput(0)
LIMIT = float(demMAX) - height

# Reclassify
outReclass = Reclassify("tin2ras3g_1", "Value", RemapRange([[float(demMIN),LIMIT,1],[LIMIT,demMAX,0]]), "NODATA")"C:/Results/ArcMap/Visibility/Calc_View/rcls")

n = 0
for i in range(num_pnts):
    n += 1
    # Spatially Balanced Points
    inRaster = "rcls"
    outPoints = "C:/Results/ArcMap/Visibility/Calc_View/point" + str(n)
    arcpy.CreateSpatiallyBalancedPoints_ga(inRaster, 1, outPoints)