Soy nuevo en arcpy y estoy teniendo problemas para ejecutar CopyRaster. Necesito un bucle for separado para este proceso como el que tengo abajo?
import os,arcpy, glob
filepath = r"C:\VMshared\small_example_valley2\snowdepthtest"
outFolder = r"C:\VMshared\small_example_valley2\snowdepthout"
ascList = glob.glob(filepath + "/*.asc")
print ascList
rasterpath = r"C:\VMshared\small_example_valley2\snowdepthout"
LastOutFolder = r"C:\VMshared\small_example_valley2\snowrast"
rasterList = glob.glob(rasterpath + "/*.tif")
print rasterList
for ascFile in ascList:
outRaster = outFolder + "/" + os.path.split(ascFile)[1][:-3] + "tif"
print outRaster
arcpy.ASCIIToRaster_conversion(ascFile, outRaster, "FLOAT")
for rasterFile in rasterList:
LastOutRaster = LastOutFolder + "/" + os.path.split(rasterFile)[1][:-3] + "tif"
arcpy.CopyRaster_management(r"C:\VMshared\small_example_valley2\snowdepthout",r"C:\VMshared\small_example_valley2\snowrast","DEFAULTS","","","NONE","NONE","16_BIT_UNSIGNED")
Edit :
Después de modificar el script, obtengo el siguiente error:
ERROR 000876: Raster de salida: C:\VMshared\small_example_valley2\snowdepthtest\snowdepthN0001.asc 's no es válida para el formato de trama de salida.
import os,arcpy, glob
filepath = r"C:\VMshared\small_example_valley2\snowdepthtest"
outFolder = r"C:\VMshared\small_example_valley2\snowdepthout"
ascList = glob.glob(filepath + "/*.asc")
rasterpath = r"C:\VMshared\small_example_valley2\snowdepthout"
OutFolderTwo = r"C:\VMshared\small_example_valley2\snowrast"
rasterList = glob.glob(rasterpath + "/*.asc")
print rasterList
for ascFile in ascList:
outRaster = os.path.join(outFolder, ascFile)
arcpy.ASCIIToRaster_conversion(ascFile, outRaster, "FLOAT")
rasterList = glob.glob(outFolder + "/*.tif")
for rasterFile in rasterList:
OutRasterTwo = os.path.join(OutFolderTwo, rasterFile)
arcpy.CopyRaster_management(rasterFile, OutRasterTwo, "DEFAULTS","","","NONE","NONE","16_BIT_UNSIGNED")