Hi,

I am new to this list so sorry if this has ever been asked or discussed.

I am using two sentinel bands in gdal_calc. they are in jp2 format and
uint16. I was surprised that subtracting one for the other (A - B) was
giving me strange results.

gdal_calc.py --calc "(A-B)" --format GTiff --type Float32 -A
/home/aneto/ARSI/data/S2A_MSIL2A_20170513T172301_N9999_R012_T14TPP_20190912T155528.SAFE/GRANULE/L2A_T14TPP_A009876_20170513T172257/IMG_DATA/R10m/T14TPP_20170513T172301_B08_10m.jp2
--A_band 1 -B
/home/aneto/ARSI/data/S2A_MSIL2A_20170513T172301_N9999_R012_T14TPP_20190912T155528.SAFE/GRANULE/L2A_T14TPP_A009876_20170513T172257/IMG_DATA/R10m/T14TPP_20170513T172301_B04_10m.jp2
--B_band 1 --outfile
/tmp/processing_90d61cb0e2a74784a9fcf4b11f9fd7dc/9945d3aec4a749d98f2a3d14694abe16/OUTPUT.tif

The result only returns positive integers, and the integers scale seems
shifted to accommodate the negative values to something above 0.

Strangely the fix comes by multiplying the values by 0.1. So (A*1.0 -
B*0.1) works as expected.

Is this a known issue? Is it the expected behavior?

Thanks,

Alexandre Neto
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to