Use GDAL metadata from an input raster gdal_translated from a DIMAP product
It looks like OTB 8.0.1 is not able to use metadata that are stored in Geotiff metadata, when doing some sensor-based operations (at least for optical calibration of Spot-6 and Spot-7 DIMAP products)
This is an example with a DIMAP from Spot-7. My goal is to convert the XS image to TOA. Here we go in plain OTB:
otbcli_OpticalCalibration -in DIM_SPOT7_MS_2021..._1.XML -out toa.tif
Everything works fine.
Now suppose I have an intermediate product, for instance a COG for the XS image.
gdal_translate DIM_SPOT7_MS_2021..._1.XML cog.tif -of COG
Now I can do some gdalinfo
on the cog.tif
gdalinfo cog.tif
We can see that GDAL (3.4.2) has exported the product metadata in the geotiff. It has everything we need for the optical calibration:
Metadata:
AREA_OR_POINT=Area
BAND_MODE=PMS
CLOUDCOVER_MEASURE_DESC=Region of interest mask
CLOUDCOVER_MEASURE_NAME=Area_Of_Interest (ROI)
CLOUDCOVER_MEASURE_TYPE=AUTOMATIC
...
...
Band 1 Block=512x512 Type=UInt16, ColorInterp=Gray
Overviews: 5069x5171, 2534x2585, 1267x1292, 633x646, 316x323
Metadata:
RADIANCE_BIAS=0
RADIANCE_CALIBRATION_DATE=2020-09-22T12:00:00Z
RADIANCE_GAIN=8.07
RADIANCE_MEASURE_DESC=Raw radiometric counts (DN) to TOA Radiance (L). Formulae L=DN/GAIN+BIAS
RADIANCE_MEASURE_UNCERTAINTY=4
RADIANCE_MEASURE_UNIT=watt/m2/steradians/micrometers
SOLAR_IRRADIANCE_CALIBRATION_DATE=2011-09-20T12:00:00Z
...
However, OTB fails to use this metadata.
My guess is that the metadata factory fails to recognize the sensor. I believe OTB should be able to do that, it would be a very useful feature.
Maybe that applies to other kind of products as well (e.g. PHR).
Do you think that is easily implementable in OTB 8.x ? Could someone can point me to the right C++ classes and metadata-classes documentation so I can take a look?
Many thanks,
Rémi