<div dir="ltr"><div>Hi,</div><div><br></div><div>I am new to this list so sorry if this has ever been asked or discussed.</div><div><br></div><div>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.</div><div><br></div><div>

<p style="margin:0px;text-indent:0px;white-space:pre-wrap">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</p></div><div></div><div><br></div><div>The result only returns positive integers, and the integers scale seems shifted to accommodate the negative values to something above 0.</div><div><br></div><div>Strangely the fix comes by multiplying the values by 0.1. So (A*1.0 - B*0.1) works as expected.</div><div><br></div><div>Is this a known issue? Is it the expected behavior?</div><div><br></div><div>Thanks,</div><div><br></div><div>Alexandre Neto<br></div></div>