I am trying to use the “optical calibration” otb function through python. However when trying to do so the following error occurs
In[15]
app = otb.Registry.CreateApplication(“OpticalCalibration”)
bandIn=output_4band(“LM02_L1TP_004069_19750625_20200908_02_T2”)
bandOut=output_4band(“LM02_L1TP_004069_19750625_20200908_02_T2”).replace(‘ALL.tif’,‘ALL_TOA.tif’)
#Input
app.SetParameterString(“in”, bandIn)
Out [15]
Cell In[15], line 8
5 bandOut=output_4band(“LM02_L1TP_004069_19750625_20200908_02_T2”).replace(‘ALL.tif’,‘ALL_TOA.tif’)
7 #Entrée
----> 8 app.SetParameterString(“in”, bandIn)
AttributeError: ‘NoneType’ object has no attribute 'SetParameterString
After some investigation, it appears that the otb “opticalCalibration” method does not exist in my installation:
In[16]
help(otb.Registry.CreateApplication(“OpticalCalibration”))
Out[16]
Help on NoneType object:
class NoneType(object)
| Methods defined here:
|
| bool(self, /)
| True if self else False
|
| repr(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| new(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
I installed OTB python binaries in two different conda environments, and I face the same problem:
-
In a first conda environment, I have installed otb version 7.1.0, with the following command line : conda install -c orfeotoolbox otb
-
In a second conda environment, otb version 8.0.1 was installed through the iota2 package, following the instructions provided here: How to get iota2? — iota2 documentation
In both cases, the otbcli_OpticalCalibration is absent from the “bin” directory of the aforementionned environments.
Is there a way to manually install this function an recompile the bindings for a specific environment?
A new version of the conda package for the python installation that includes this function?
Any other workaround to be able to use this application within a python script?
Thank you for your help.