I am trying to convert more than 100 ascii files to raster using python code. All the lines (except Last two) in my code presented below is successfully converting Ascii to tif format in the working directory. However, I want to save the new TIF files in a separate directory. Therefore, the last two lines in my code, I am trying to save in a new directory. But, I am getting the below error:
"Traceback (most recent call last):
File "C:\Subhasis\Project-Biological_monitoring\R_SAGA\Raster_data\ASCII_Raster.py", line 22, in <module>
AttributeError: 'Result' object has no attribute 'save'"
Thanks lot for your time and help!
import arcpy, os from arcpy import env from arcpy.sa import * #To overwrite output arcpy.env.overwriteOutput = True #set work environment env.workspace = "C:/Subhasis/Project-Biological_monitoring/R_SAGA/Raster_data" outWorkspace="C:/Subhasis/Project-Biological_monitoring/R_SAGA/Raster_data/Final" dataType="INTEGER" # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") for file in arcpy.ListFiles("*.asc"): outputraster = file.strip(".asc")+ ".tif" Ascii_raster=arcpy.ASCIIToRaster_conversion(file,outputraster,dataType) outname=os.path.join(outWorkspace,outputraster) Ascii_raster.save(outname)