GPT NdviOp: Error: GDAL Geotiff writer cannot write

I am using the following GPT command to create NDVIs for a series of Setinel-2 images I have. The script/commands works for only a few of the images I have, for the others I get the following error.

gpt NdviOp -Ssource=MTD_MSIL2A.xml -t ndvi.tif

Error: GDAL Geotiff writer cannot write a product containing bands with different data types (the data type of band index 1 is 12, different from band index 0).

I’m not sure what is going on, I’m using scripts to download and extract all images, so they should all be the same, I have not noticed any issues with images that give this error as well.

How can I fix this?

That’s Strange. Actually the gdal driver should not be active when calling gpt like this.
To use a specific writer please add the format parameter like:

gpt NdviOp -Ssource=MTD_MSIL2A.xml -f GeoTIFF -t ndvi.tif


Adding the -f GeoTIFF parameter fixes the error, thanks for that!

On another note, I’ve noticed that the size of the output is now almost 960mb which is almost double the size I am getting for the other files.

When using GeoTiff as format the data is not compressed.
You can use as format GeoTIFF-BigTIFF instead.

1 Like