[gdal-dev] gdal_calc issue

Alber Sánchez alber.ipia at inpe.br
Thu Feb 6 05:53:52 PST 2020


Good morning,

I unable to use gdal_calc to make a pixel-wise computation between two
tiffs with several bands.

I have two tifs, each contains time series of the same spectral band.
For example, file1.tif contains a time series of RED and file2.tif
contains a time series of NIR (near infrared). The dates of the time
series in both files match. I would like to create a third file with a
pixel-wise computation between the first two files for which I'm using
gdal_calc as follows:

gdal_calc.py -A file1.tif -B file2.tif --calc="((A - B) / (A + B +
0.00001)) * 10000" --outfile=result.tif

This runs but only uses the first band in both files. I know about the
"allBands" flag, but it only handles one of the files, not both. For
example, this produces the wrong results because it only uses the first
band in file2.tif:

gdal_calc.py -A file1.tif -B file2.tif --calc="((A - B) / (A + B
+0.00001)) * 10000" --outfile=result.tif --allBands=A --allBands=B

Am I doing something wrong? Is there another way?

By the way, I prepared two samples files, available here:

https://www.dropbox.com/sh/a3yoxz34rsm1qqi/AAChpBHarBc5fiC19AlEnyk3a?dl=0

I'm sorry if I'm posting this question in the wrong list.

Thanks a lot!

-- 
Alber Sánchez
National Institute for Space Research
Earth System Science Center
São José dos Campos, SP, Brazil





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200206/73f95a0b/attachment-0001.sig>


More information about the gdal-dev mailing list