AnsweredAssumed Answered

Saving output with predefined name

Question asked by skasprick on Jan 28, 2016
Latest reply on Jan 28, 2016 by skasprick

I am trying to clip a raster and save the output with a predefined name to a file geodatabase which will be defined by the user as a parameter.  I have tried two different angles, and both give me errors.

 

Trial 1

# Import modules

import arcpy

from arcpy import env

from arcpy.sa import *

 

# Input Parameters

Boundary = arcpy.GetParameterAsText(0)

InRaster = arcpy.GetParameterAsText(1)

GDBLoc = arcpy.GetParameterAsText(2) # data type set as workspace

 

# Clip Raster

Raster = arcpy.Clip_management(InRaster, "", "in_memory", Boundary, "0", "ClippingGeometry", "NO_MAINTAIN_EXTENT")

RasName = ("GDBLoc" + "\\PredefinedName")

Raster.save(RasName)

 

 

Results in:

AttributeError: 'Result' object has no attribute 'save'

 

Trial 2

# Import modules

import arcpy

from arcpy import env

from arcpy.sa import *

 

# Input Parameters

Boundary = arcpy.GetParameterAsText(0)

InRaster = arcpy.GetParameterAsText(1)

GDBLoc = arcpy.GetParameterAsText(2) # data type set as workspace

 

# Clip Raster

Raster = arcpy.Clip_management(InRaster, "", "GDBLoc + \\PredefinedName", Boundary, "0", "ClippingGeometry", "NO_MAINTAIN_EXTENT")

 

Results in:

ExecuteError: ERROR 999999: Error executing function.

Outcomes