Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
EnMAP
GFZ_Tools_EnMAP_BOX
EnPT
Commits
8a630d4d
Commit
8a630d4d
authored
Apr 18, 2018
by
Daniel Scheffler
Browse files
Fixed import issues within tests. Fixed test _radiometric_transform.
parent
30ac11f5
Pipeline
#2920
failed with stages
in 4 minutes and 18 seconds
Changes
7
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
enpt/options/config.py
View file @
8a630d4d
...
...
@@ -33,6 +33,12 @@ path_enptlib = os.path.dirname(pkgutil.get_loader("enpt").path)
path_options_default
=
os
.
path
.
join
(
path_enptlib
,
'options'
,
'options_default.json'
)
config_for_testing
=
dict
(
path_l1b_enmap_image
=
os
.
path
.
join
(
path_enptlib
,
'tests'
,
'data'
,
'EnMAP_Level_1B'
,
'AlpineTest1_CWV2_SM0.zip'
),
output_dir
=
os
.
path
.
join
(
path_enptlib
,
'tests'
,
'data'
,
'test_outputs'
)
)
class
EnPTConfig
(
object
):
def
__init__
(
self
,
json_config
=
''
,
**
user_opts
):
"""Create a job configuration.
...
...
@@ -83,7 +89,7 @@ class EnPTConfig(object):
# toa_ref
self
.
path_earthSunDist
=
self
.
absPath
(
gp
(
'path_earthSunDist'
))
self
.
path_solar_irr
=
self
.
absPath
(
gp
(
'path_solar_irr'
))
self
.
scale_factor_toa_ref
=
gp
(
'scale_factor_toa_ref'
)
,
self
.
scale_factor_toa_ref
=
gp
(
'scale_factor_toa_ref'
)
# geometry
self
.
enable_keystone_correction
=
gp
(
'enable_keystone_correction'
)
...
...
tests/__init__.py
View file @
8a630d4d
# -*- coding: utf-8 -*-
import
os
enptRepo_rootpath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
))
config_for_testing
=
dict
(
path_l1b_enmap_image
=
os
.
path
.
join
(
enptRepo_rootpath
,
'tests'
,
'data'
,
'EnMAP_Level_1B'
,
'AlpineTest1_CWV2_SM0.zip'
),
output_dir
=
os
.
path
.
join
(
enptRepo_rootpath
,
'tests'
,
'data'
,
'test_outputs'
)
)
tests/test_cli_parser.py
View file @
8a630d4d
...
...
@@ -13,10 +13,10 @@ import os
from
runpy
import
run_path
from
multiprocessing
import
cpu_count
from
enpt
import
__path__
import
enpt
path_run_enpt
=
os
.
path
.
abspath
(
os
.
path
.
join
(
__path__
[
0
],
'..'
,
'bin'
,
'enpt_cli.py'
))
path_run_enpt
=
os
.
path
.
abspath
(
os
.
path
.
join
(
enpt
.
__path__
[
0
],
'..'
,
'bin'
,
'enpt_cli.py'
))
class
Test_CLIParser
(
TestCase
):
...
...
tests/test_config.py
View file @
8a630d4d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
...
...
@@ -11,7 +12,7 @@ from json import \
dumps
,
\
JSONDecodeError
from
unittest
import
TestCase
from
unittest
import
TestCase
,
main
from
enpt.options.config
import
\
get_options
,
\
...
...
@@ -87,3 +88,7 @@ class Test_EnPTConfig(TestCase):
# check validity
EnPTValidator
(
allow_unknown
=
True
,
schema
=
enpt_schema_config_output
).
validate
(
params
)
if
__name__
==
'__main__'
:
main
()
tests/test_controller.py
View file @
8a630d4d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
...
...
@@ -7,12 +8,11 @@ test_controller
Tests for `execution.controller` module.
"""
from
unittest
import
TestCase
from
unittest
import
TestCase
,
main
import
shutil
from
enpt.execution.controller
import
EnPT_Controller
from
.
import
config_for_testing
from
enpt.options.config
import
config_for_testing
class
Test_EnPT_Controller
(
TestCase
):
...
...
@@ -25,3 +25,7 @@ class Test_EnPT_Controller(TestCase):
def
test_run_all_processors
(
self
):
self
.
CTR
.
run_all_processors
()
if
__name__
==
'__main__'
:
main
()
tests/test_l1b_reader.py
View file @
8a630d4d
...
...
@@ -17,8 +17,7 @@ import zipfile
from
datetime
import
datetime
import
shutil
from
enpt.options.config
import
EnPTConfig
from
.
import
config_for_testing
from
enpt.options.config
import
EnPTConfig
,
config_for_testing
class
Test_L1B_Reader
(
unittest
.
TestCase
):
...
...
tests/test_radiometric_transform.py
View file @
8a630d4d
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
os
import
unittest
from
unittest
import
TestCase
,
main
from
glob
import
glob
import
tempfile
import
zipfile
from
datetime
import
datetime
from
enpt.processors
import
Radiometric_Transformer
from
enpt.options.config
import
EnPTConfig
from
enpt.options.config
import
EnPTConfig
,
config_for_testing
from
.
import
config_for_testing
class
Test_Radiometric_Transformer
(
unittest
.
TestCase
):
class
Test_Radiometric_Transformer
(
TestCase
):
def
setUp
(
self
):
"""Set up the needed test data"""
self
.
cfg
=
EnPTConfig
(
**
config_for_testing
)
self
.
pathList_testimages
=
glob
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"data"
,
"EnMAP_Level_1B"
,
"*.zip"
))
self
.
RT
=
Radiometric_Transformer
(
config
=
self
.
cfg
)
...
...
@@ -48,3 +46,7 @@ class Test_Radiometric_Transformer(unittest.TestCase):
self
.
assertIsInstance
(
L1_obj
,
EnMAPL1Product_SensorGeo
)
self
.
assertTrue
(
L1_obj
.
vnir
.
detector_meta
.
unitcode
==
'TOARef'
)
self
.
assertTrue
(
L1_obj
.
swir
.
detector_meta
.
unitcode
==
'TOARef'
)
if
__name__
==
"__main__"
:
main
()
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment