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
f0fd071a
Commit
f0fd071a
authored
7 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
prepost.hawcstab2: added support for reading amp files
parent
05e952af
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/prepost/h2_vs_hs2.py
+2
-2
2 additions, 2 deletions
wetb/prepost/h2_vs_hs2.py
wetb/prepost/hawcstab2.py
+46
-25
46 additions, 25 deletions
wetb/prepost/hawcstab2.py
with
48 additions
and
27 deletions
wetb/prepost/h2_vs_hs2.py
+
2
−
2
View file @
f0fd071a
...
@@ -311,10 +311,10 @@ class Sims(object):
...
@@ -311,10 +311,10 @@ class Sims(object):
mt
[
'
[hawc2]
'
]
=
False
mt
[
'
[hawc2]
'
]
=
False
mt
[
'
[output]
'
]
=
False
mt
[
'
[output]
'
]
=
False
mt
[
'
[copyback_files]
'
]
=
[
'
./*.ind
'
,
'
./*.pwr
'
,
'
./*.log
'
,
mt
[
'
[copyback_files]
'
]
=
[
'
./*.ind
'
,
'
./*.pwr
'
,
'
./*.log
'
,
'
./*.cmb
'
,
'
./*.bea
'
]
'
./*.cmb
'
,
'
./*.bea
'
,
'
./*.amp
'
]
mt
[
'
[copyback_frename]
'
]
=
[
mt
[
'
[res_dir]
'
],
mt
[
'
[res_dir]
'
],
mt
[
'
[copyback_frename]
'
]
=
[
mt
[
'
[res_dir]
'
],
mt
[
'
[res_dir]
'
],
mt
[
'
[log_dir]
'
],
mt
[
'
[res_dir]
'
],
mt
[
'
[log_dir]
'
],
mt
[
'
[res_dir]
'
],
mt
[
'
[res_dir]
'
]]
mt
[
'
[res_dir]
'
],
mt
[
'
[res_dir]
'
]]
if
mt
[
'
[hs2_bladedeform_switch]
'
]:
if
mt
[
'
[hs2_bladedeform_switch]
'
]:
mt
[
'
[hs2_bladedeform]
'
]
=
'
bladedeform
'
mt
[
'
[hs2_bladedeform]
'
]
=
'
bladedeform
'
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/hawcstab2.py
+
46
−
25
View file @
f0fd071a
...
@@ -28,6 +28,8 @@ class dummy(object):
...
@@ -28,6 +28,8 @@ class dummy(object):
def
__init__
(
self
,
name
=
'
dummy
'
):
def
__init__
(
self
,
name
=
'
dummy
'
):
self
.
__name__
=
name
self
.
__name__
=
name
regex_units
=
re
.
compile
(
'
(
\\
[.*?
\\
])
'
)
def
ReadFileHAWCStab2Header
(
fname
):
def
ReadFileHAWCStab2Header
(
fname
):
"""
"""
...
@@ -35,38 +37,31 @@ def ReadFileHAWCStab2Header(fname):
...
@@ -35,38 +37,31 @@ def ReadFileHAWCStab2Header(fname):
includes the column number and units between square brackets.
includes the column number and units between square brackets.
"""
"""
regex
=
re
.
compile
(
'
(
\\
[.*?
\\
])
'
)
def
_read
(
fname
,
header
=
0
,
widths
=
[
20
]
*
15
,
skipfooter
=
0
):
df
=
pd
.
read_fwf
(
fname
,
header
=
header
,
widths
=
widths
,
def
_withgradients
(
fname
):
skipfooter
=
skipfooter
)
df
=
pd
.
read_fwf
(
fname
,
header
=
1
,
widths
=
[
30
]
*
27
)
units
=
regex_units
.
findall
(
''
.
join
(
df
.
columns
))
# find all units
units
=
regex
.
findall
(
''
.
join
(
df
.
columns
))
df
.
columns
=
[
k
[:
-
2
].
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
return
df
,
units
def
_newformat
(
fname
):
df
=
pd
.
read_fwf
(
fname
,
header
=
0
,
widths
=
[
20
]
*
15
)
# find all units
units
=
regex
.
findall
(
''
.
join
(
df
.
columns
))
df
.
columns
=
[
k
[:
-
2
].
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
return
df
,
units
def
_oldformat
(
fname
):
df
=
pd
.
read_fwf
(
fname
,
header
=
0
,
widths
=
[
14
]
*
13
)
# find all units
units
=
regex
.
findall
(
''
.
join
(
df
.
columns
))
df
.
columns
=
[
k
.
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
return
df
,
units
return
df
,
units
with
open
(
fname
)
as
f
:
with
open
(
fname
)
as
f
:
line
=
f
.
readline
()
line
=
f
.
readline
()
# when gradients are included in the output
if
len
(
line
)
>
800
:
if
len
(
line
)
>
800
:
return
_withgradients
(
fname
)
df
,
units
=
_read
(
fname
,
header
=
1
,
widths
=
[
30
]
*
27
)
if
len
(
line
)
>
200
:
# column name has the name, unit and column number in it...
return
_newformat
(
fname
)
df
.
columns
=
[
k
[:
-
2
].
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
return
df
,
units
elif
len
(
line
)
>
200
:
df
,
units
=
_read
(
fname
,
header
=
0
,
widths
=
[
20
]
*
15
)
# column name has the name, unit and column number in it...
df
.
columns
=
[
k
[:
-
2
].
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
return
df
,
units
# older versions of HS2 seem to have two columns less
else
:
else
:
return
_oldformat
(
fname
)
df
,
units
=
_read
(
fname
,
header
=
0
,
widths
=
[
14
]
*
13
)
df
.
columns
=
[
k
.
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
return
df
,
units
class
InductionResults
(
object
):
class
InductionResults
(
object
):
...
@@ -158,6 +153,32 @@ class results(object):
...
@@ -158,6 +153,32 @@ class results(object):
self
.
ind
=
InductionResults
()
self
.
ind
=
InductionResults
()
self
.
ind
.
read
(
fname
)
self
.
ind
.
read
(
fname
)
def
load_amp
(
self
,
fname
):
with
open
(
fname
)
as
f
:
line
=
f
.
readline
()
width
=
14
nrcols
=
int
((
len
(
line
)
-
1
)
/
width
)
# first columns has one extra character
# col nr1: rotor speed, col nr2: radius
widths
=
[
width
+
1
]
+
[
width
]
*
(
nrcols
-
1
)
# last line is empty
df
=
pd
.
read_fwf
(
fname
,
header
=
2
,
widths
=
widths
,
skipfooter
=
1
)
units
=
regex_units
.
findall
(
''
.
join
(
df
.
columns
))
# no column number in the column name
# since U_x, u_y, phase and theta will be repeated as many times as
# there are modes, add the mode number in the column name
columns
=
[
k
.
replace
(
'
#
'
,
''
).
strip
()
for
k
in
df
.
columns
]
nrmodes
=
int
((
len
(
columns
)
-
2
)
/
6
)
for
k
in
range
(
nrmodes
):
for
i
in
range
(
6
):
j
=
2
+
k
*
6
+
i
columns
[
j
]
=
columns
[
j
].
split
(
'
.
'
)[
0
]
+
'
nr%i
'
%
(
k
+
1
)
df
.
columns
=
columns
return
df
,
units
def
load_operation
(
self
,
fname
):
def
load_operation
(
self
,
fname
):
operation
=
np
.
loadtxt
(
fname
,
skiprows
=
1
)
operation
=
np
.
loadtxt
(
fname
,
skiprows
=
1
)
...
...
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