I have a python script to run the tool Extract Mulit Values to Points. In that script I have created a list of raster files from a directory that I would like to use as input for this tool. I would also like to be able to specify the field name. The problem I am having is that the list doesn't "look" the way the tool wants it. Here is a snippet.
#Import system modules
import arcpy
import os
from arcpy import env
from arcpy.sa import *
#Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
#Set environment settings - Location of Rasters
arcpy.env.workspace = r"N:\Raster\PRISM\DailyData\Rasters"
#Input Point Feature
inPnt = r"D:\workspace\r_prism2.shp"
#Create list of rasters for input to tool
listRa = arcpy.ListRasters()
inRasterList = []
for i in listRa:
inRasterList.append(i + " " + "P" + i[27:31])
#Execute Tool
arcpy.sa.ExtractMultiValuesToPoints(inPnt,inRasterList,"BILINEAR")
print "finished"So, the inRasterList looks like this- the raster file name followed by the field name which was extraced from the file name.
Raster_20010116.bil P0116
Raster_20010117.bil P0117
Raster_20010118.bil P0118
I think I am very close but I don't have it in the format the tool wants:
[["Raster_20010116.bil","P0116"],["Raster_20010117.bil","P0117"],"Raster_20010118.bil", "P0118"]]
I could create a file like this and read it in but would like to do it all within Python. Any help would be appreciated!