OpticalCalibration - issue with Python

I have a KOMPSAT-3 product and running the cli with:

otbcli_OpticalCalibration -in /workspace/data/K3_20160924182455_23243_19350803_L1G/K3_20160924182455_23243_19350803_L1G_G.tif -out K3_20160924182455_23243_19350803_L1G_G_CALIBRATION.tif float -ram 128 -milli true -clamp false -acqui.minute 24 -acqui.hour 18 -acqui.day 24 -acqui.month 9 -acqui.year 2016 -acqui.sun.elev 51 -acqui.sun.azim 313 -acqui.gainbias k3_gainbias_green.txt -acqui.solarilluminations k3_solarillumination_green.txt -atmo.aerosol noaersol

works fine while using Python, the image has all pixel values set to 1000.

Here’s the code snippet

OTB_app1 = otbApplication.Registry.CreateApplication("OpticalCalibration")

OTB_app1.SetParameterString("in", item)
OTB_app1.SetParameterString("level", level)
OTB_app1.SetParameterInt('ram', 4096)
OTB_app1.SetParameterString('acqui.gainbias', gainbias[index])
OTB_app1.SetParameterString('acqui.solarilluminations', solarillumination[index])
OTB_app1.SetParameterFloat('acqui.sun.elev', ele)
OTB_app1.SetParameterFloat('acqui.sun.azim', azi)
OTB_app1.SetParameterInt('acqui.minute', minute)
OTB_app1.SetParameterInt('acqui.hour', hour)
OTB_app1.SetParameterInt('acqui.day', day)
OTB_app1.SetParameterInt('acqui.month', month)
OTB_app1.SetParameterInt('acqui.year', year)
OTB_app1.SetParameterString('atmo.aerosol', 'noaersol')
OTB_app1.SetParameterString('out', tmp_oc[index])
OTB_app1.SetParameterString('outxml', tmp_oc[index] + '.xml')
OTB_app1.SetParameterString("milli", '1')
OTB_app1.DisableParameter('clamp')
    
OTB_app1.ExecuteAndWriteOutput()

This used to work a few versions ago - see https://groups.google.com/forum/#!topic/otb-users/ZDKgVkoRp5o

Any help is really appreciated

Hello

What does your image output using cli looks like ? do all pixels have values superior to 1000 ? I don’t think this should happen, as reflectance usually have values between 0 and 1 (or 0 and 1000 in milli).

Can you try with OTB_app1.SetParameterString("clamp", '0') instead of OTB_app1.DisableParameter('clamp') ?

with this parameter set to on the image is clamped to the range [0,1], or [0,1000] with the milli option.

Cédric

Hello Cedric,

Thanks, that solved the issue.

Hi I’m having a difficult applying Optical Calibration in my Kompsat-3 images. I am using the OTB plugin in QGIS but it won’t work and produced an image with pixel values of 1000. Also, it showed a warning on the log message:

Since you were able to run Kompsat-3 image in the OpticalCalibration, can you help me with this one?