Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gts2
gts2_client
Commits
03c0c4f8
Commit
03c0c4f8
authored
Jan 22, 2018
by
Hannes Diedrich
Browse files
Improved testing.
parent
0ea7ca76
Pipeline
#1790
passed with stages
in 19 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gts2_client/gts2_client.py
View file @
03c0c4f8
...
...
@@ -50,7 +50,7 @@ class Gts2Request(dict):
latrange
=
ur
[
1
]
-
ll
[
1
]
lonrange
=
ur
[
0
]
-
ll
[
0
]
if
(
lonrange
>=
thres
)
|
(
latrange
>=
thres
):
raise
Exception
(
"Your requestst area too large: ({lon}°x{lat}° excedes 0.2°x0.2°)"
.
format
(
lat
=
latrange
,
raise
ValueError
(
"Your requestst area too large: ({lon}°x{lat}° excedes 0.2°x0.2°)"
.
format
(
lat
=
latrange
,
lon
=
lonrange
))
def
__init__
(
self
,
opts
,
logger
=
None
):
...
...
@@ -824,7 +824,6 @@ def str2bool(v):
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
parser
.
add_argument
(
"-o"
,
"--out_dir"
,
action
=
"store"
,
required
=
True
,
type
=
str
,
help
=
"output_directory"
)
...
...
@@ -877,7 +876,7 @@ if __name__ == "__main__":
args
=
parser
.
parse_args
()
if
"_"
in
args
.
out_prefix
:
raise
Exception
(
"out_prefix contains '_'. Please use different character, e.g. '-'."
)
raise
ValueError
(
"out_prefix contains '_'. Please use different character, e.g. '-'."
)
suffix
=
"coreg"
if
(
args
.
coreg
is
True
)
else
""
...
...
tests/test_gts2_client.py
View file @
03c0c4f8
...
...
@@ -195,6 +195,45 @@ class TestGts2Client(unittest.TestCase):
:return:
"""
try
:
out_mode
=
"stack"
print
(
"#### Testing '_' in prefix "
)
gts2_client
.
client
(
out_prefix
=
"test_"
,
out_mode
=
out_mode
,
geo_ll
=
geo_ll
,
geo_ur
=
geo_ur
,
bands
=
"B05"
,
start_date
=
start_date
,
end_date
=
end_date
,
version
=
version
,
level
=
level
,
max_cloudy
=
max_cloudy
,
minimum_fill
=
minimum_fill
,
stack_resolution
=
stack_res
,
quiet
=
False
)
except
ValueError
:
print
(
"Test OK."
)
try
:
out_mode
=
"stack"
print
(
"#### Testing too large area"
)
gts2_client
.
client
(
out_mode
=
out_mode
,
geo_ll
=
geo_ll
,
geo_ur
=
(
12.737961
+
0.2
,
53.238058
+
0.2
),
bands
=
"B05"
,
start_date
=
start_date
,
end_date
=
end_date
,
version
=
version
,
level
=
level
,
max_cloudy
=
max_cloudy
,
minimum_fill
=
minimum_fill
,
stack_resolution
=
stack_res
,
quiet
=
False
)
except
ValueError
:
print
(
"Test OK."
)
try
:
out_mode
=
"python"
print
(
"#### Testing stack_resolution=60"
)
...
...
@@ -234,7 +273,7 @@ class TestGts2Client(unittest.TestCase):
print
(
"Test OK."
)
try
:
out_mode
=
"do
w
snotwork"
out_mode
=
"do
e
snotwork"
print
(
"#### Testing wrong out_mode"
)
gts2_client
.
client
(
out_mode
=
out_mode
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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