Unexpected behavior with shape if some results are intermediately written to disk in a pipeline
When an intermediate result is written to disk while being part of an in-memory pipeline, we have a problem with the final shape being smaller than what it should be.
import pyotb
# this is ok
input = pyotb.Input('my_sentinel2_4bands.tif')
res = input + 1
res.shape # (10980, 10980, 4)
# try to write an intermediate result
input.write('/tmp/tmp.tif')
# this is not ok
res_new = input + 1
res_new.shape # (10980, 675, 4) NB: 675 corresponds to the size of the last block used for writing `input`
res_new.write('/tmp/tmp2.tif') # this writes a (10980, 675, 4) raster to disk
Possible solution: It seems that when writing to disk with write
function, we could Execute
the app right after ExecuteAndWriteOutput
and the shape would be "back to normal"