Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
9394299e
Commit
9394299e
authored
10 years ago
by
Rashad Kanavath
Browse files
Options
Downloads
Patches
Plain Diff
TEST: new style otb python: a test for each parameter type
Signed-off-by:
Rashad Kanavath
<
rashad.kanavath@c-s.fr
>
parent
edd66076
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py
+114
-0
114 additions, 0 deletions
...Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py
with
114 additions
and
0 deletions
Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py
0 → 100644
+
114
−
0
View file @
9394299e
# -*- coding: utf-8 -*-
#
# Example on the use of otb "pythonization"
#
from
sys
import
argv
import
otbApplication
as
otb
def
cm_assert
(
a
,
b
):
print
"
debug print before assert check:
'
%s
'
==
'
%s
'"
%
(
a
,
b
)
assert
a
==
b
app
=
otb
.
Registry
.
CreateApplication
(
'
OrthoRectification
'
)
# one test for each parameter type (string, float, int, ...)
# # parameter group io.in
# 1 - input image parameter set
app
.
IO
.
IN
=
argv
[
1
]
cm_assert
(
app
.
GetParameterString
(
'
io.in
'
),
argv
[
1
])
# 2 - input image parameter get
cm_assert
(
app
.
IO
.
IN
,
argv
[
1
])
# # parameter group io.in
# 3 - output image parameter set
app
.
IO
.
OUT
=
argv
[
2
]
cm_assert
(
app
.
GetParameterString
(
'
io.out
'
),
argv
[
2
])
# 4 - output image parameter get
cm_assert
(
app
.
IO
.
OUT
,
argv
[
2
])
# 5 - choice with sub parameters set
app
.
MAP
=
'
lambert2
'
cm_assert
(
app
.
GetParameterString
(
'
map
'
),
'
lambert2
'
)
# 5.1 - choice with sub parameters get
app
.
SetParameterString
(
'
map
'
,
'
wgs
'
)
cm_assert
(
'
wgs
'
,
app
.
MAP
)
# 5.2 - choice with sub parameters set
app
.
MAP
=
'
lambert93
'
cm_assert
(
'
lambert93
'
,
app
.
GetParameterString
(
'
map
'
))
# 5.3 - choice with sub parameters set
app
.
SetParameterString
(
'
map
'
,
'
epsg
'
)
cm_assert
(
app
.
MAP
,
'
epsg
'
)
# 6 - int type 2nd level sub parameters of choice parameter set
app
.
MAP
.
EPSG
.
CODE
=
32768
cm_assert
(
32768
,
app
.
GetParameterInt
(
'
map.epsg.code
'
))
# 7 - another choice with sub parameters set
app
.
MAP
=
'
utm
'
cm_assert
(
'
utm
'
,
app
.
GetParameterString
(
'
map
'
))
# 8 - int type sub parameters of choice parameter set
app
.
MAP
.
UTM
.
ZONE
=
47
cm_assert
(
47
,
app
.
GetParameterInt
(
'
map.utm.zone
'
))
# 9 - int type sub parameters of choice parameter get
app
.
SetParameterInt
(
'
map.utm.zone
'
,
31
)
cm_assert
(
app
.
MAP
.
UTM
.
ZONE
,
31
)
# 10 - bool type sub parameters of choice parameter get
app
.
DisableParameter
(
'
map.utm.northhem
'
)
cm_assert
(
app
.
MAP
.
UTM
.
NORTHHEM
,
False
)
# 11 - bool type sub parameters of choice parameter set
app
.
MAP
.
UTM
.
NORTHHEM
=
True
cm_assert
(
True
,
app
.
IsParameterEnabled
(
'
map.utm.northhem
'
)
)
#12 - simple choice parameter set
app
.
OUTPUTS
.
MODE
=
'
auto
'
cm_assert
(
'
auto
'
,
app
.
GetParameterString
(
'
outputs.mode
'
))
#13 - simple choice parameter get
app
.
SetParameterString
(
'
outputs.mode
'
,
'
orthofit
'
)
cm_assert
(
app
.
OUTPUTS
.
MODE
,
'
orthofit
'
)
#14 - inputxml parameter set
app
.
INXML
=
'
input.xml
'
cm_assert
(
app
.
GetParameterString
(
'
inxml
'
),
'
input.xml
'
)
#15 - outputxml parameter get
app
.
SetParameterString
(
'
outxml
'
,
'
output.xml
'
)
cm_assert
(
"
output.xml
"
,
app
.
OUTXML
)
#16 - parameter float get
app
.
SetParameterFloat
(
'
elev.default
'
,
5.0
)
cm_assert
(
5.0
,
app
.
ELEV
.
DEFAULT
)
#17 -parameter float set
app
.
ELEV
.
DEFAULT
=
-
2.5
cm_assert
(
app
.
GetParameterFloat
(
'
elev.default
'
),
-
2.5
)
#18 - parameter ram get
app
.
SetParameterString
(
'
opt.ram
'
,
'
256
'
)
cm_assert
(
256
,
app
.
OPT
.
RAM
)
#19 - parameter ram set
app
.
OPT
.
RAM
=
'
512
'
cm_assert
(
app
.
GetParameterInt
(
'
opt.ram
'
),
512
)
#20 - parameter bool set
app
.
OUTPUTS
.
ISOTROPIC
=
True
cm_assert
(
app
.
IsParameterEnabled
(
'
outputs.isotropic
'
),
True
)
#21 - parameter bool get
app
.
DisableParameter
(
'
outputs.isotropic
'
)
cm_assert
(
False
,
app
.
OUTPUTS
.
ISOTROPIC
)
# #app.ExecuteAndWriteOutput()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment