I'm loading several bands and images as VRT to obtain a mosaic. Each of these bands can have an offset and/or scale that I'm already taking care of. When transforming the resulting VRT into a TIFF file, the bands don't have this scale and offset applied, instead, these values are noted in the metadata for each band. Is there any way I can apply these scale and offset when building the TIFF with gdalwarp
?
Add a comment
|
1 Answer
As far as I'm aware gdalwarp
can't do this directly, but gdal_translate
can be used with the -unscale
argument:
-unscale
Apply the scale/offset metadata for the bands to convert scaled values to unscaled values. It is also often necessary to reset the output datatype with the -ot switch. The unscaled value is computed from the scaled raw value with the following formula:
unscaled_value = scaled_value * scale + offset
https://gdal.org/programs/gdal_translate.html#cmdoption-gdal_translate-unscale