I am writing a Python script to try to clip a raster generated by Idw_3d interpolation, but it's throwing the infamous 000732 error. I've looked at my file path, and it does exist there. I've opened it up with ArcMap, and it's there. However, I still get the error saying:
ERROR 000732: Input Features: Dataset precipNew does not exist or is not supported
Note: I'm using IDLE for my IDE.
Here is my code:
import arcpy
from arcpy import env
#Not the actual workspace, it has been changed for this example
env.workspace = "C:\\Documents\\WeatherData.shp"
env.overwriteOutput = True
arcpy.CheckOutExtension("3d")
#arcpy.ListFeatureClasses() indicates that all of the data is present that I need to work with.
#Declare local variables
precipPoints = "PrecipMontana2014"
#Make feature class for the points to be interpolated
arcpy.MakeFeatureLayer_management(points, "points_lyr")
#IDW
arcpy.Idw_3d(in_point_features ="points_lyr", z_field = "RASTERVALU", out_raster = "precipNew")
####Everything works fine until this point, when I try to clip it####
#MontanaBoundary is the boundary I want to clip the IDW raster to
arcpy.Clip_analysis(in-features = "precipNew", clip_features = "MontanaBoundary", out_feature_class = "output1")
The error then throws after this line.
1 Answer 1
Use arcpy.Clip_management()
to clip a raster, not arcpy.Clip_analysis()
which is for clipping a vector feature class.
-
I tried that, both in the IDLE shell and creating a script, but I always get the
RESTART: Shell
notification. Would you happen to know why that would happen? It always wants to restart (without completing the process) when I run thearcpy.Clip_management
process.sneeze_shiny– sneeze_shiny2019年10月22日 01:44:48 +00:00Commented Oct 22, 2019 at 1:44 -
1You may need to post your full code (perhaps as a separate new question).Son of a Beach– Son of a Beach2019年10月22日 01:52:58 +00:00Commented Oct 22, 2019 at 1:52
arcpy.MakeFeatureLayer_management(precipPoints, "points_lyr")
, sorry about that.