<div dir="ltr">Even if I converted the input file into Float 32 at first, the resulted image is still totally black.</div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">cleo</div></div>
<br><br><div class="gmail_quote">On Tue, Jul 29, 2014 at 11:20 PM, Vincent Schut <span dir="ltr"><<a href="mailto:schut@sarvision.nl" target="_blank">schut@sarvision.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="">
    On 07/29/2014 04:04 PM, Cleo Drakos wrote:<br>
    <blockquote type="cite">
      <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>
    </blockquote>
    <br></div>
    I don't use gdal_calc myself, but I suppose the problem is the byte
    datatype. I would try to convert the input data to float32 first
    (use gdal_translate -ot Float32) and try again.<br>
    <br>
    Best,<br>
    Vincent.<div class=""><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <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>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>
                        <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>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
    <br>
  </div></div>

<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">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><br></blockquote></div><br></div>