I have written a stand-alone Python script to perform an ExtractByMask operation on numerous raster files in ArcMap, that have a .bil extension format. However, when I try to save my output, I get the following runtime error:
Below is what my code looks like currently:
#Import necessary system modules import arcpy,os from arcpy import env from arcpy.sa import * #Location where raster (.bil) files are located. arcpy.env.workspace=r"D:\Mike_Daily_PRISM_PPT_from_2007_through2016\ 2007_Test" arcpy.CheckOutExtension('Spatial') #Location where output files should go after "for" loop has completed. outws=r"D:\Mike_Daily_PRISM_PPT_from_2007_through2016\2007_Test\Output" #Location of the shapefile used to mask the PRISM raster(.bil) files mask=r"D:\Mike_Daily_PRISM_PPT_from_2007_through2016\2007_Test\ MissouriBound.shp" #Only search for files that have .bil extension. rasterlist=arcpy.ListDatasets("*.bil","Raster") #Print the list of raster files that have a .bil extension print rasterlist #for i in rasterlist, perform an ExtractByMask function on each raster. for i in rasterlist: outExtractByMask=ExtractByMask(i, mask) outname=os.path.join(outws, str(i)) outExtractByMask.save(outname)
I believe the error has something to do with the format that it's trying to save the output format raster with. [Note: Actually, I would prefer to save the output in a TIFF format (.tif).] Can anyone confirm whether that is the issue with my code, and how I can then modify it to save the output with a .tif extension?