Skip to content

DynamicConvert doesn't work for some S2 products

Description

For some S2 products, DynamicConvert produces all black output. The same usage works fine for other products. And Convert work in all cases.

I am using this test script:

#!/bin/bash

export PATH=$PATH:~/Downloads/OTB-6.6.0-Linux64/bin/

TVT_input="S2A_MSIL1C_20180520T112121_N0206_R037_T30TVT_20180520T132551.SAFE/MTD_MSIL1C.xml"
TVT_b02="S2A_MSIL1C_20180520T112121_N0206_R037_T30TVT_20180520T132551.SAFE/GRANULE/L1C_T30TVT_A015192_20180520T112543/IMG_DATA/T30TVT_20180520T112121_B02.jp2"

otbcli_BandMath -il $TVT_input -exp "im1b1==0" -out TVT_mask0.tif uint8
otbcli_Convert -in $TVT_b02 -mask TVT_mask0.tif -hcp.low 2 -hcp.high 2 -out TVT_convert.tif uint8 -type linear
otbcli_DynamicConvert -in $TVT_b02 -mask TVT_mask0.tif -quantile.low 2 -quantile.high 2 -out TVT_dynamic_convert.tif uint8 -type linear -outmin 1 -outmax 255

XDK_input="S2A_MSIL1C_20180620T040541_N0206_R047_T52XDK_20180620T083057.SAFE/MTD_MSIL1C.xml"
XDK_b02="S2A_MSIL1C_20180620T040541_N0206_R047_T52XDK_20180620T083057.SAFE/GRANULE/L1C_T52XDK_A015631_20180620T040543/IMG_DATA/T52XDK_20180620T040541_B02.jp2"

otbcli_BandMath -il $XDK_input -exp "im1b1==0" -out XDK_mask0.tif uint8
otbcli_Convert -in $XDK_b02 -mask XDK_mask0.tif -hcp.low 2 -hcp.high 2 -out XDK_convert.tif uint8 -type linear
otbcli_DynamicConvert -in $XDK_b02 -mask XDK_mask0.tif -quantile.low 2 -quantile.high 2 -out XDK_dynamic_convert.tif uint8 -type linear -outmin 1 -outmax 255

With these two products:

Steps to reproduce

Download the two products above and run the script.

Configuration information

Confirmed with OTB 6.4 and 6.6 on multiple Linux hosts.