donalkc

Setting workspace dynamically as part of out path

Discussion created by donalkc on Jul 21, 2013
Latest reply on Jul 21, 2013 by donalkc
Hi all,
I've successfully managed to set my workspace as a 'arcpy.GetParameterAsText(0)'. I then created a file GDB and I'm now trying to create a rasterdataset in this file GDB. The rasterdataset wants  an 'out_path' to be set. I tried what I have below:

# Create Raster Dataset
out_path = "Prog.gdb"
out_name = "R_Dataset"
# Run the Create Raster Dataset Script
arcpy.CreateRasterDataset_management (out_path, out_name, "", "8_BIT_UNSIGNED", "", "1", "", "PYRAMIDS -1 NEAREST DEFAULT 75 NO_SKIP", "128 128", "LZ77", "")
# Mosaic Rasters into a the Raster Dataset
inputs = arcpy.ListRasters("", "TIF")
# Set the target to the Raster Dataset that was already created
target = "R_Dataset"
# Run the Mosaic tool
arcpy.Mosaic_management (inputs, target, "LAST", "FIRST", "", "", "NONE", "0", "NONE")
# Set local variables
in_raster = "R_Dataset"
in_mask_data = "Study_area_extent"
#Extract by Mask
outExtractByMask = arcpy.sa.ExtractByMask (in_raster, in_mask_data)


I want to know is there anyway for the original workspace to become part of the out_path when another user runs the code, so it would be something like 'Workspace + Prog.gdb".

Thanks

Outcomes