rkgautam

Read specific raster file using python

Discussion created by rkgautam on Jan 17, 2012
Latest reply on Jan 17, 2012 by rkgautam
I am trying to read a specific raster image file using python, however, getting some difficulties. Can you please help me?

Here is the details about the files:

import arcpy
import sys, os, string
from arcpy.sa import *
from arcpy import env
arcpy.env.workspace = "D:\Project\Stanislaus\Timeseries\NDVI"
LstRst = arcpy.ListRasters("*", "img")
for Rst in LstRst:
    Img1 = string.find(Rst, "_stanislaus.img")
    if Img1 > -1:
        print Rst
     

when I print Rst, it prints all raster images with _stanislaus.img. Now, I need to read an specific image like "aug08_2010_stanislaus.img". Can you please tell me how to do that?

Thanks

Outcomes