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
9f8ae4ad
Commit
9f8ae4ad
authored
8 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
nan support in mean_deg
parent
12ae789a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/utils/geometry.py
+1
-1
1 addition, 1 deletion
wetb/utils/geometry.py
wetb/utils/tests/test_geometry.py
+3
-0
3 additions, 0 deletions
wetb/utils/tests/test_geometry.py
with
4 additions
and
1 deletion
wetb/utils/geometry.py
+
1
−
1
View file @
9f8ae4ad
...
...
@@ -35,7 +35,7 @@ def mean_deg(dir, axis=0):
mean_deg : float
Mean angle
"""
return
deg
(
np
.
arctan2
(
np
.
mean
(
sind
(
dir
[:]),
axis
),
np
.
mean
(
cosd
(
dir
[:]),
axis
)))
return
deg
(
np
.
arctan2
(
np
.
nan
mean
(
sind
(
dir
[:]),
axis
),
np
.
nan
mean
(
cosd
(
dir
[:]),
axis
)))
def
std_deg
(
dir
):
"""
Standard deviation of angles in degrees
...
...
This diff is collapsed.
Click to expand it.
wetb/utils/tests/test_geometry.py
+
3
−
0
View file @
9f8ae4ad
...
...
@@ -57,6 +57,9 @@ class TestGeometry(unittest.TestCase):
np
.
testing
.
assert_array_almost_equal
(
mean_deg
(
a
,
1
),
[
45
,
0
,
-
45
])
np
.
testing
.
assert_array_almost_equal
(
mean_deg
(
a
.
T
,
0
),
[
45
,
0
,
-
45
])
def
test_mean_deg_nan
(
self
):
self
.
assertEqual
(
mean_deg
(
np
.
array
([
0.
,
90
,
np
.
nan
])),
45
)
def
test_std_deg
(
self
):
self
.
assertEqual
(
std_deg
(
np
.
array
([
0
,
0
,
0
])),
0
)
...
...
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