Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
toolbox
WindEnergyToolbox
Commits
23903d9d
There was a problem fetching the pipeline summary.
Commit
23903d9d
authored
7 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
fixed test
parent
b233dd6d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/wind/turbulence/tests/test_constraint_file.py
+13
-13
13 additions, 13 deletions
wetb/wind/turbulence/tests/test_constraint_file.py
with
13 additions
and
13 deletions
wetb/wind/turbulence/tests/test_constraint_file.py
+
13
−
13
View file @
23903d9d
...
...
@@ -19,18 +19,18 @@ class TestConstraintFile(unittest.TestCase):
tu
=
np
.
array
([
time
,
u
]).
T
tuvw
=
np
.
array
([
time
,
u
,
v
,
w
]).
T
glpos
=
(
0
,
0
,
-
85
)
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
(
glpos
,
tu
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
1
],
(
6
,
4
,
4
,
0
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
-
90
),
box_transport_speed
=
5
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
-
90
),
box_transport_speed
=
5
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
(
glpos
,
tuvw
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
2
],
(
6
,
4
,
4
,
2
))
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
v
'
][
2
],
(
6
,
4
,
4
,
-
.
5
))
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
w
'
][
2
],
(
6
,
4
,
4
,
2
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
((
-
10
,
-
4
,
-
95
),
tu
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
1
],
(
8
,
5
,
5
,
0
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
4
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
4
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
((
-
10
,
0
,
-
95
),
tu
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
1
],
(
8
,
5
,
5
,
0
))
#constraint_file.save("./test_files", "constraints_test",'')
...
...
@@ -41,7 +41,7 @@ class TestConstraintFile(unittest.TestCase):
tu
=
np
.
array
([
time
,
u
]).
T
glpos
=
(
0
,
0
,
-
85
)
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
([
0
,
0
,
0
],
tu
,
subtract_mean
=
False
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
-
1
],
(
1
,
5
,
5
,
5
))
constraint_file
.
add_constraints
([
5
,
0
,
0
],
tu
,
subtract_mean
=
False
)
...
...
@@ -56,19 +56,19 @@ class TestConstraintFile(unittest.TestCase):
u
=
[
5
]
tu
=
np
.
array
([
time
,
u
]).
T
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
([
0
,
0
,
0
],
tu
,
subtract_mean
=
False
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
-
1
],
(
1
,
5
,
5
,
5
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
-
5
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
-
5
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
([
0
,
0
,
0
],
tu
,
subtract_mean
=
False
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
-
1
],
(
1
,
5
,
4
,
5
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
0
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
([
0
,
0
,
0
],
tu
,
subtract_mean
=
False
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
-
1
],
(
1
,
4
,
5
,
5
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
10
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
10
,
0
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
add_constraints
([
0
,
0
,
0
],
tu
,
subtract_mean
=
False
)
np
.
testing
.
assert_array_equal
(
constraint_file
.
constraints
[
'
u
'
][
-
1
],
(
6
,
5
,
5
,
5
))
...
...
@@ -81,7 +81,7 @@ class TestConstraintFile(unittest.TestCase):
tu
=
np
.
array
([
time
,
u
]).
T
tuvw
=
np
.
array
([
time
,
u
,
v
,
w
]).
T
glpos
=
(
0
,
0
,
-
85
)
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
-
85
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
-
85
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
self
.
assertRaisesRegex
(
ValueError
,
"
At time, t=0, global position \(0,0,-44\)
"
,
constraint_file
.
add_constraints
,
(
0
,
0
,
-
85
+
35
+
6
),
tu
)
self
.
assertRaisesRegex
(
ValueError
,
"
At time, t=0, global position \(0,0,-126\)
"
,
constraint_file
.
add_constraints
,
(
0
,
0
,
-
85
-
35
-
6
),
tu
)
self
.
assertRaisesRegex
(
ValueError
,
"
At time, t=0, global position \(-41,0,-85\)
"
,
constraint_file
.
add_constraints
,
(
-
35
-
6
,
0
,
-
85
),
tu
)
...
...
@@ -90,18 +90,18 @@ class TestConstraintFile(unittest.TestCase):
self
.
assertRaisesRegex
(
ValueError
,
"
At time, t=2, global position \(0,-13,-85\)
"
,
constraint_file
.
add_constraints
,
(
0
,
-
13
,
-
85
),
tu
)
def
test_hawc2_cmd
(
self
):
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
-
85
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
0
,
0
,
-
85
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
mann
=
constraint_file
.
hawc2_mann_section
(
"
test
"
,
1
)
self
.
assertEqual
(
mann
.
box_dim_u
.
values
,
[
16
,
1.875
])
def
test_load
(
self
):
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
4
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
4
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
load
(
get_test_file
(
'
constraints_test.con
'
))
with
open
(
get_test_file
(
'
constraints_test.con
'
))
as
fid
:
self
.
assertEqual
(
str
(
constraint_file
),
fid
.
read
())
def
test_time_series
(
self
):
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
4
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
dimension
=
(
30
,
70
,
70
))
constraint_file
=
ConstraintFile
(
center_gl_xyz
=
(
-
5
,
4
,
-
90
),
box_transport_speed
=
10
,
no_grid_points
=
(
16
,
8
,
8
),
box_
size
=
(
30
,
70
,
70
))
constraint_file
.
load
(
get_test_file
(
'
constraints_test.con
'
))
time
,
uvw
=
constraint_file
.
time_series
(
-
4
)
u
,
v
,
w
=
uvw
.
T
...
...
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