Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try:
- arcpy.env.workspace = r"Y:GISStudents_2013_14Winter_2014PRESCOTT_JOSHUA_BPYTHONweek6_midtermGIS255 midtermTahoe.gdb"
- clippedrast = "arowner"
- allrasters = arcpy.ListRasters()
- for soilrasters in allrasters:
- ##check for existence of output rasters here##
- if soilrasters == clippedrast:
- print "Checking rasters"
- elif soilrasters == (soilrasters[0:2]+"owner"):
- print soilrasters + " Output already exists"
- elif soilrasters[-4:]== "soil":
- arcpy.Clip_management(clippedrast, "#", soilrasters[0:2]+"owner", soilrasters)
- print "Finished clipping " + clippedrast + " to " + soilrasters + ". Name of output raster is " + soilrasters[0:2]+"owner."
- else:
- print "n"
- # except statement#
- except Exception as e:
- print "Script Failed"
- print e.message
- print "n"
- # except statement to print out any geoprocessing errors
- except:
- print arcpy.GetMessages(2)
- # else statement to print out results
- else:
- print "n"
- print "Script finished successfully"
- print "n"
- print "****RESULTS****"
- print arcpy.GetMessages(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement