<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dear List Members,<br><br>I am using Landsat single band image as input and I want to apply the equation shown below in the script and write the output to a new raster file.<br><br>1. The below pasted script works fine without 'cos' term but it fails with 'cos' term even if I imported python math module. Should I import any other module so that the script will recognize 'cos' term?<br><br>2. I want my output data to be in same projection and pixel size as my input data. What command do I have to use to maintain the projection details and pixel size?<br><br>3. My input data is 8 bit and I want my output data also in 8 bit. How can I maintain the data mode?<br><br>script:<br>from PIL import Image, ImageMath<br>import os, math<br>os.curdir = 'C:/temp'<br>im = Image.open("testraster.tif")<br>out = ImageMath.eval("((3.14*(((0.11*im) + lmin)*25))/(70*cos(50*
 0.0174)))", im=im, lmax= 30, lmin= 0.37)<br>out.save("outRaster.tif")<br><br>print 'All done...'<br><br><div><div><div><div><font size="4"><font face="comic sans ms"><em><font color="#0000ff"></font></em></font></font><font color="#ff0000" face="comic sans ms">Traceback (most recent call last):<br>&nbsp; File "C:\temp\reflectance.py", line 7, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; out = ImageMath.eval("((3.14*(((0.11*im) + lmin)*25))/(70*cos(50* 0.0174)))", im=im, lmax= 30, lmin= 0.37)<br>&nbsp; File "C:\Python25\Lib\site-packages\PIL\ImageMath.py", line 203, in eval<br>&nbsp;&nbsp;&nbsp; out =__builtin__.eval(expression, args)<br>&nbsp; File "&lt;string&gt;", line 1, in &lt;module&gt;<br>NameError: name 'cos' is not defined<br></font></div> <div><br>I looked in the Imaginbook and its tutorial section, but didn't find the exact answer to my questions. I would appreciate any suggestion or help to solve my problem.<br><br>Thanks in
 advance.<br><br>Santosh <br> <div dir="ltr"></div></div></div></div></div></td></tr></table><br>
      <!--1--><hr size=1></hr> Connect with friends all over the world. <a href="http://in.rd.yahoo.com/tagline_messenger_1/*http://in.messenger.yahoo.com/?wm=n/"> Get Yahoo! India Messenger.</a>