[gdal-dev] Does gdal_calc.py not calculate arithmetic with in the same file?

Cleo Drakos cleo21drakos at gmail.com
Tue Jul 29 18:43:18 PDT 2014


yes, I checked the histogram and the out image is completely black.

cleo


On Wed, Jul 30, 2014 at 1:53 AM, Jukka Rahkonen <jukka.rahkonen at mmmtike.fi>
wrote:

> Cleo Drakos <cleo21drakos <at> gmail.com> writes:
>
> >
> > Thanks for your response.I tried the followings:
> >
> >
> > gcalc = 'C:\\Users\\cleo\\Documents\\gdalpys\\gdal_calc.py'
> > ##I produced second file (b)as the copy of first(a)
> >
> > a = 'D:\\a.tif'
> > b = 'D:\\b.tif'
> > outfile = 'D:\\result.tif'
> > expr = '(A-B)/(A+B)'
> > subprocess.call([sys.executable,gcalc,'-A',a,'--A_band','1','-B',b,
> '--B_band','0','--outfile',outfile,\
> >
> >     '--calc',expr,'--type','Float32','--format','ENVI'],shell=True)
> > a,b,outfile = None, None,None
> >
> >
> > Unfortunately, resulted file is completely black.
> >
> >
> > I hope someone can help me.
> Have you checked from the histogram that the result is totally black? I
> could imagine that bands 1 (A) and 2 (B) can have values close to each
> other which makes that A-B is close to zero. That divided by A+B makes
> the values even closer to zero and if such Float32 type image is opened
> in an image viewer without LUT stretch that could well appear as
> totally black. Forget all this if you have checked the histograms.
>
> -Jukka Rahkonen-
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140730/c28df944/attachment.html>


More information about the gdal-dev mailing list