<div dir="ltr">Thanks for your response.<div>I tried the followings:</div><div><br></div><div><div>gcalc = 'C:\\Users\\cleo\\Documents\\gdalpys\\gdal_calc.py'</div><div>##I produced second file (b)as the copy of first(a)<br>
</div><div>a = 'D:\\a.tif'</div><div>b = 'D:\\b.tif'</div><div>outfile = 'D:\\result.tif'</div><div>expr = '(A-B)/(A+B)'</div><div>subprocess.call([sys.executable,gcalc,'-A',a,'--A_band','1','-B',b,'--B_band','0','--outfile',outfile,\</div>
<div> '--calc',expr,'--type','Float32','--format','ENVI'],shell=True) </div><div>a,b,outfile = None, None,None</div></div><div><br></div><div>Unfortunately, resulted file is completely black.</div>
<div><br></div><div>I hope someone can help me.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 29, 2014 at 10:37 PM, Etienne Tourigny <span dir="ltr"><<a href="mailto:etourigny.dev@gmail.com" target="_blank">etourigny.dev@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am not sure, but you can do the following to make sure:<div><br></div><div>cp infile infile2</div><div>
<span style="font-family:arial,sans-serif;font-size:13px">gdal_calc.py -A infile --A_band 1 -B infile2 --B_band 0 --outfile outfile --calc "(A-B)/(A+B)" </span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Also, perhaps the extra comma in your command might be to blame "</span><font face="arial, sans-serif">-B infile,"</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Etienne</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Jul 29, 2014 at 3:46 AM, Cleo Drakos <span dir="ltr"><<a href="mailto:cleo21drakos@gmail.com" target="_blank">cleo21drakos@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi GDAL Developers,<br><br>I have one GeoTIFF file with 2 bands. The data type is Byte. I want to calculate (Band2-Band1)/(Band2+Band1).<br>
<br>But the following command provided a dark image:<br><br>gdal_calc.py -A infile --A_band 1 -B infile, --B_band 0 --outfile outfile --calc "(A-B)/(A+B)" <br>
<br>Does gdal_calc.py not calculate arithmetic with in the same file?<br><br>Thanks for your time.<span><font color="#888888"><br><br>cleo<br></font></span></div>
<br></div></div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div></div></blockquote></div>
</div></div>