ExtractROI and OrthoRectification loose band metadata from PHR DIMAP files
Description
When using OrthoRectification or ExtractROI applications, the result file doen't not contain the band metadata (ex : calibration coefficients, radiance values, etc.) initially contained in the DIMAP file.
Steps to reproduce
This problem had been observed with OTB 7.x, with PHR images (DIMAP file + associated TIF).
Ex :
gdalinfo DIM_PHR1B_PMS_202007181100059_SEN_5196690101.XML
gives the following output :
Driver: DIMAP/SPOT DIMAP
Files: DIM_PHR1B_PMS_202007181100059_SEN_5196690101.XML
IMG_PHR1B_PMS_202007181100059_SEN_5196690101_R1C1.TIF
IMG_PHR1B_PMS_202007181100059_SEN_5196690101_R1C2.TIF
IMG_PHR1B_PMS_202007181100059_SEN_5196690101_R2C1.TIF
IMG_PHR1B_PMS_202007181100059_SEN_5196690101_R2C2.TIF
Size is 25330, 20050
Coordinate System is `'
Metadata:
BAND_MODE=PX
CLOUDCOVER_MEASURE_NAME=Area_Of_Interest (ROI)
CLOUDCOVER_MEASURE_TYPE=AUTOMATIC
[....]
Band 1 Block=128x128 Type=UInt16, ColorInterp=Undefined
Metadata:
RADIANCE_BIAS=0
RADIANCE_CALIBRATION_DATE=2020-07-01T16:00:00.000Z
RADIANCE_GAIN=9.72
If we extract an area :
otbcli_ExtractROI -in DIM_PHR1B_PMS_202007181100059_SEN_5196690101.XML -out xt_PHR.tif -startx 0 -starty 0 -sizex 100 -sizey 100
gdalinfo xt_PHR.tif
gives this :
Driver: GTiff/GeoTIFF
Files: xt_PHR.tif
Size is 100, 100
Coordinate System is `'
Metadata:
BAND_MODE=PX
CLOUDCOVER_MEASURE_NAME=Area_Of_Interest (ROI)
CLOUDCOVER_MEASURE_TYPE=AUTOMATIC
[...]
Upper Right ( 100.0, 0.0)
Lower Right ( 100.0, 100.0)
Center ( 50.0, 50.0)
Band 1 Block=100x5 Type=Float32, ColorInterp=Gray
Band 2 Block=100x5 Type=Float32, ColorInterp=Undefined
Band 3 Block=100x5 Type=Float32, ColorInterp=Undefined
Band 4 Block=100x5 Type=Float32, ColorInterp=Undefined
Configuration information
OTB 7.0, 7.1, + current develop version
Workaround
As a workaround, we've used gdal from the Python API to copy band metadata
This bug seems quite similar to #1937 (closed)