bcohen

Concatenating user input into output path/filename

Discussion created by bcohen on Sep 7, 2011
Latest reply on Sep 8, 2011 by bcohen
I'm running a script that takes three pieces of user input, uses those as weights for a raster calcluation, and then saves the output raster layer.

I'd like to use those input values as part of the filename for the output raster, but, unfortunately, I''m not sure how (I copied most of this script from other places).

I'm pretty sure I need to set the input values as a string (which I have in a comment line), but how do I use those in the final line where I save the output file? Thanks for any help!

Script:
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *


#set workspace
arcpy.env.workspace = "C:/GISTemp"


#assign variables to raster layers
reduced_west = Raster("reduced_west")
offsite_west = Raster("offsite_west")
frag_west = Raster("frag_west")


# Set the parameters from user input
RecoverInput = arcpy.GetParameter(0)
FragInput = arcpy.GetParameter(1)
OffsiteInput = arcpy.GetParameter(2)


# Convert input to percent
recoverweight = RecoverInput / 100
fragweight = FragInput / 100
offsiteweight = OffsiteInput / 100

# Check out Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Calculate ouput layer
WeightedOutput = ((reduced_west * recoverweight) + (offsite_west * offsiteweight) + (frag_west * fragweight)) / 3

# outpath = "C:/GISTemp/ModelOutput/Out_"
# outname = str(RecoverInput) + "_" + str(FragInput) + "_" + str(OffsiteInput)

WeightedOutput.save("C:/GISTemp/ModelOutput/Out_2")

Outcomes