mardi 24 mars 2015

Failed to execute (ExtractByMask)


I use ExtractByMask of arcpy to isolate to subset the provinces of the Philippines. I do it with this code.



import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
env.overwriteOutput = True

#Set the current workspace
env.workspace = (r"C:\thesis\LATEST\LATEST Forest Masks\ESSC")
env.nodata = "MINIMUM"
env.compression = "LZ77"


list_10_110 = ['Sulu.shp','Palawan.shp','Tawi-Tawi.shp']
#This is for extracting the forest areas of hansen percent treecover
#loop the list
for i in list_10_110:
print "Extracting " + i + " in 10_110"
env.workspace = (r"C:\thesis\LATEST\LATEST Forest Masks\ESSC")
for raster in arcpy.ListRasters("*10N_110E.tif", "TIF"):
env.workspace = (r"C:\thesis\LATEST\LATEST Forest Masks\ESSC")
print raster #checking the presence of raster
outputRasterExtractbyMask = ExtractByMask(raster, i)
#prov=i.replace(".shp", "_")
#outputRasterExtractbyMask_Name = prov + raster
#env.workspace = (r"C:\thesis\LATEST\LATEST Forest Masks\ESSC\Per Province")
#outputRasterExtractbyMask.save(outputRasterExtractbyMask_Name)


However, I'm getting this error message:



Traceback (most recent call last):
File "C:\Users\brentiebark\Dropbox\Python Scripts and mxds\extract by mask_NAMRIA.py"
outputRasterExtractbyMask = ExtractByMask(raster, i)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line
6631, in ExtractByMask in_mask_data)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Utils.py", line 47,
in swapper result = wrapper(*args, **kwargs)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py",
line 6627, in wrapper out_raster)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py",
line 484, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 010024: Error during conversion.
Failed to execute (ExtractByMask).


I've checked my input raster and input mask (.shps), and didn't seem to find any mistake.





Aucun commentaire:

Enregistrer un commentaire