[Image-SIG] raster extent problem

santosh panda santoshh19 at yahoo.co.in
Wed Apr 8 20:25:43 CEST 2009

Dear List members,

The python script pasted below does a calculation using the each pixel value of input data and writes it to new output raster. I also want to retrieve the extent and projection details from the input raster and pass it to output raster. gp.defineprojection() adds the projection details, but out.transform() fails to update the extent details in output raster. Am I doing anything wrong here or Is there any other way to pass the extent details from input to output raster?

I would appreciate any suggestion or help on this problem.

Thanks in advance...

from PIL import Image, ImageMath
import os, math, arcgisscripting
gp = arcgisscripting.create(9.3)
os.curdir = 'C:/temp'
input = raw_input("Enter input raster name and path with extension: ")
output = raw_input("Enter output raster name with extension: ")
lmax = float(raw_input("Enter lmax value: "))
lmin = float(raw_input("Enter lmin value: "))
d = float(raw_input("Enter d value: "))
eSun = float(raw_input("Enter esun value: "))
elv = float(raw_input("Enter elevation value: "))
im = Image.open(input)
def function(pixel):
    return float((math.pi*((((lmax - lmin)/255)*pixel) + lmin)* d**2)/(eSun * math.cos((90 - elv)* .017453293)))
size = im.size
out = im.point(function)

out.transform(size, Image.AFFINE, (30, 0, 326385, 0, 30, 6391185))
projection = 'C:/Program Files/ArcGIS/Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/WGS 1984 UTM Zone 4N.prj'
gp.DefineProjection_management(output, projection)
print 'All done...'

      Check out the all-new Messenger 9.0! Go to http://in.messenger.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090408/11db784d/attachment.htm>

More information about the Image-SIG mailing list