Duplicate writing of intermediate results
#19 (closed) has been solved since 1.4.0, the following piece of code now works
import pyotb
xs = pyotb.OpticalCalibration('some_4bands_raster.tif')
nir = xs[:, :, 3]
r = xs[:, :, 0]
ndvi = (nir - r)/(nir + r)
xs.write("xs.tif", pixel_type='uint8')
ndvi.write("ndvi.tif", pixel_type='uint8')
However, there is an unnecessary (and unwanted) write of xs
on the last line of code:
>>> ndvi.write("ndvi.tif", pixel_type='uint8')
2022-06-28 10:02:44 (INFO) OpticalCalibration: Compute Top of Atmosphere reflectance
2022-06-28 10:02:44 (INFO) OpticalCalibration: Clamp values between [0, 100]
2022-06-28 10:02:44 (INFO): Estimated memory for full processing: 11111.2MB (avail.: 256 MB), optimal image partitioning: 44 blocks
2022-06-28 10:02:44 (INFO): File xs.tif will be written in 49 blocks of 1536x1536 pixels
Writing /tmp/xs.tif...: 100% [**************************************************] (5s)
2022-06-28 10:02:49 (INFO): Loading kwl metadata from attached geom file xs.geom
2022-06-28 10:02:49 (INFO) BandMath: Image #1 has 4 components
2022-06-28 10:02:49 (INFO): Estimated memory for full processing: 4259.28MB (avail.: 256 MB), optimal image partitioning: 17 blocks
2022-06-28 10:02:49 (INFO): File ndvi.tif will be written in 18 blocks of 9656x559 pixels
Writing /tmp/ndvi.tif...: 100% [**************************************************] (3s)