AnsweredAssumed Answered

ERROR 000732: Input Features: Dataset _  does not exist or is not supported

Question asked by cmays10 on Mar 2, 2017
Latest reply on Mar 3, 2017 by dkwiens

I have seen a few questions with this error, but none of the fixes worked for me.  

I am trying to use the clipping data management tool to clip raster files to a shapefile of polygons.  I have also tried to do the same thing with the Extract by Mask tool and I got the same error.

 

This is the error: ERROR 000732: Output Extent: Dataset PerRanktop10percentTPA2001.shp does not exist or is not supported
Failed to execute (Clip).

 

The error says that the shapefile PerRanktop10percentTPA2001.shp does not exist, but when I use the print statement in line 39 it prints out this file, so it definitely exists and the script can find it. 

 

Hope someone can help!

 

Here's my code:

#import necessary packages
import arcpy
import os
from arcpy import env


#sets workspace to ADS folder
env.workspace = "Z:/Fall2016_GlacierNationalParkClimate/Term2/Charlotte/ADS/ADS_PerRanktop10percentTPA2001"
#turns overwrite on
env.overwriteOuput = True
#lists shapefiles
shapefiles = arcpy.ListFeatureClasses("*")
print (shapefiles)
#changes year to match ADS year
shapefile = shapefiles[0]
year = shapefile [22:26]
print (year)

#sets workspace to rasters folder
env.workspace = "Z:/Fall2016_GlacierNationalParkClimate/Term2/Charlotte/RGI/RGI_2000_2003"
env.overwriteOuput = True

#Lists folders in workspace
folders = arcpy.ListWorkspaces()
for folder in folders:
     env.workspace = folder
     env.overwriteOuput = True
     #lists rasters in all folers
     rasters = arcpy.ListRasters("*", "tif")
     print (rasters)

     for raster in rasters:
          #Names inputs and outputs for each raster in each folder
          in_raster = rasters[0]
          in_template_dataset = shapefiles[0]
          out_raster = ("clip_ads_" + year + raster.split(".")[0] + ".tif")
          output_path = "Z:/Fall2016_GlacierNationalParkClimate/Term2/Charlotte/RGI_ADS_clip_output"
          
          print(in_template_dataset)

          #runs clip data management
          clip = arcpy.Clip_management(in_raster, "#", output_path + out_raster, in_template_dataset, "#", "ClippingGeometry","NO_MAINTAIN_EXTENT")

Outcomes