Skip to content

Treat Parameter_RAM as an integer parameter in SetParameterValue (Swig Wrapper)

Cédric Traizet requested to merge 2200_ram_parameter_python into develop

Summary

In the Python wrapper, in the SetParameterValue(parameter, value) method of the Application class, ram parameters are expected to be provided as string, whereas GetParameterValue(parameter) returns an integer when parameter is a Parameter_RAM. As RAM parameters are defined as unsigned integer numerical parameters it makes more sense to define the Python type of ram parameters to int.

Without this MR, the behavior of Parameter_RAM is:

app = otb.Registry.CreateApplication("EdgeExtraction")
app.SetParameterValue("ram", "512") # OK 
app.SetParameterString("ram", "512") # OK 
app.SetParameterInt("ram", 512) # OK
app.RAM = "512" # OK
app.SetParameterValue("ram", 512) # ERROR 
app.RAM = 512 # ERROR

With this MR, the behavior of Parameter_RAM is:

app = otb.Registry.CreateApplication("EdgeExtraction")
app.SetParameterValue("ram", "512") # ERROR 
app.SetParameterString("ram", "512") # OK 
app.SetParameterInt("ram", 512) # OK
app.RAM = "512" # ERROR
app.SetParameterValue("ram", 512) # OK 
app.RAM = 512 # OK

See #2200 (closed)

I tagged this MR as breaking , because it can cause errors in python client code setting the ram parameter with a string.

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Cédric Traizet

Merge request reports

Loading