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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
wtlib
WindEnergyToolbox
Commits
3a31fb84
Commit
3a31fb84
authored
7 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
prepost.hawcstab2: HS2 .ind files can have two different colwidths
parent
bba2525c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/prepost/hawcstab2.py
+36
-12
36 additions, 12 deletions
wetb/prepost/hawcstab2.py
with
36 additions
and
12 deletions
wetb/prepost/hawcstab2.py
+
36
−
12
View file @
3a31fb84
...
...
@@ -21,7 +21,7 @@ import re
import
numpy
as
np
import
pandas
as
pd
from
wetb.prepost
import
mplutils
from
wetb.prepost
import
(
mplutils
,
misc
)
class
dummy
(
object
):
...
...
@@ -64,17 +64,31 @@ def ReadFileHAWCStab2Header(fname):
return
df
,
units
# FIXME: with gradients currently ind has columns width of 28 instead of 14!!
class
InductionResults
(
object
):
def
__init__
(
self
):
pass
"""
Column width can vary between versions and with/withouth gradient in
output. Use get_col_width() for automatic detection.
"""
def
__init__
(
self
,
colwidth
=
14
):
"""
with gradients currently ind has columns width of 28 instead of 14!
"""
self
.
cw
=
colwidth
def
get_col_width
(
self
,
fname
):
# figure out column width
with
open
(
fname
)
as
fid
:
fid
.
readline
()
line2
=
fid
.
readline
()
cols
=
misc
.
remove_items
(
line2
.
split
(
'
'
),
''
)
if
len
(
cols
[
0
])
>
15
:
self
.
cw
=
28
def
read
(
self
,
fname
):
self
.
data
=
np
.
loadtxt
(
fname
)
self
.
wsp
=
int
(
fname
.
split
(
'
_u
'
)[
-
1
][:
-
4
])
/
1000.0
try
:
self
.
df_data
=
pd
.
read_fwf
(
fname
,
header
=
0
,
widths
=
[
14
]
*
38
)
self
.
df_data
=
pd
.
read_fwf
(
fname
,
header
=
0
,
widths
=
[
self
.
cw
]
*
38
)
except
:
self
.
df_data
=
pd
.
read_fwf
(
fname
,
header
=
0
,
widths
=
[
14
]
*
34
)
self
.
df_data
=
pd
.
read_fwf
(
fname
,
header
=
0
,
widths
=
[
self
.
cw
]
*
34
)
# sanitize the headers
cols
=
self
.
df_data
.
columns
self
.
df_data
.
columns
=
[
k
[:
-
2
].
replace
(
'
#
'
,
''
).
strip
()
for
k
in
cols
]
...
...
@@ -150,8 +164,13 @@ class results(object):
return
frf
def
load_ind
(
self
,
fname
):
self
.
ind
=
InductionResults
()
def
load_ind
(
self
,
fname
,
colwidth
=
None
):
"""
for results withouth gradients, colwidth=14, otherwise 28. Set to
None to derive automatically.
"""
self
.
ind
=
InductionResults
(
colwidth
=
colwidth
)
if
colwidth
is
None
:
self
.
ind
.
get_col_width
(
fname
)
self
.
ind
.
read
(
fname
)
def
load_amp
(
self
,
fname
):
...
...
@@ -289,14 +308,19 @@ class results(object):
dpi
=
dpi
,
num
=
0
)
for
i
,
res
in
enumerate
(
results
):
ax
=
axes
[
0
,
0
]
ax
.
plot
(
res
.
wind
,
res
.
power
,
color
=
colors
[
i
],
label
=
labels
[
i
],
ax
.
plot
(
res
.
wind
,
res
.
power
,
color
=
colors
[
i
],
label
=
'
Power %s
'
%
labels
[
i
],
marker
=
symbols
[
i
],
ls
=
'
-
'
,
alpha
=
alphas
[
i
])
ax
.
set_title
(
'
Aerodynamic Power [kW]
'
)
ax
.
set_title
(
'
Aerodynamic Power [kW]
'
)
#, RPM')
ax
=
axes
[
0
,
1
]
ax
.
plot
(
res
.
wind
,
res
.
pitch_deg
,
color
=
colors
[
i
],
label
=
labels
[
i
],
ax
.
plot
(
res
.
wind
,
res
.
pitch_deg
,
color
=
colors
[
i
],
label
=
'
Pitch %s
'
%
labels
[
i
],
marker
=
symbols
[
i
],
ls
=
'
-
'
,
alpha
=
alphas
[
i
])
ax
.
set_title
(
'
Pitch [deg]
'
)
ax
.
plot
(
res
.
wind
,
res
.
rpm
,
color
=
colors
[
i
],
label
=
'
RPM %s
'
%
labels
[
i
],
marker
=
symbols
[
i
],
ls
=
'
--
'
,
alpha
=
alphas
[
i
])
ax
.
set_title
(
'
Pitch [deg], RPM
'
)
ax
=
axes
[
1
,
0
]
ax
.
plot
(
res
.
wind
,
res
.
thrust
,
color
=
colors
[
i
],
label
=
labels
[
i
],
...
...
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