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
61b7a249
There was a problem fetching the pipeline summary.
Commit
61b7a249
authored
9 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
io.open: text files py23 compat ok, not ok for binary files
parent
5843a33e
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wetb/hawc2/Hawc2io.py
+8
-3
8 additions, 3 deletions
wetb/hawc2/Hawc2io.py
wetb/hawc2/ascii2bin/pandas_dat_ascii2bin.py
+0
-1
0 additions, 1 deletion
wetb/hawc2/ascii2bin/pandas_dat_ascii2bin.py
wetb/prepost/windIO.py
+8
-8
8 additions, 8 deletions
wetb/prepost/windIO.py
with
16 additions
and
12 deletions
wetb/hawc2/Hawc2io.py
+
8
−
3
View file @
61b7a249
...
...
@@ -33,13 +33,18 @@ from __future__ import unicode_literals
from
__future__
import
absolute_import
from
builtins
import
int
from
builtins
import
range
from
io
import
open
from
io
import
open
as
opent
from
builtins
import
str
from
future
import
standard_library
standard_library
.
install_aliases
()
from
builtins
import
object
import
numpy
as
np
import
os
# FIXME: numpy doesn't like io.open binary fid in PY27, why is that? As a hack
# workaround, use opent for PY23 compatibility when handling text files,
# and default open for binary
################################################################################
################################################################################
################################################################################
...
...
@@ -71,7 +76,7 @@ class ReadHawc2(object):
"""
# read *.sel hawc2 output file for result info
fid
=
open
(
self
.
FileName
+
'
.sel
'
,
'
r
'
)
fid
=
open
t
(
self
.
FileName
+
'
.sel
'
,
'
r
'
)
Lines
=
fid
.
readlines
()
fid
.
close
()
# findes general result info (number of scans, number of channels,
...
...
@@ -102,7 +107,7 @@ class ReadHawc2(object):
# read sensor file used if results are saved in FLEX format
DirName
=
os
.
path
.
dirname
(
self
.
FileName
+
"
.int
"
)
try
:
fid
=
open
(
DirName
+
"
\sensor
"
,
'
r
'
)
fid
=
open
t
(
DirName
+
"
\sensor
"
,
'
r
'
)
except
IOError
:
print
(
"
can
'
t finde sensor file for FLEX format
"
)
return
...
...
This diff is collapsed.
Click to expand it.
wetb/hawc2/ascii2bin/pandas_dat_ascii2bin.py
+
0
−
1
View file @
61b7a249
...
...
@@ -7,7 +7,6 @@ from __future__ import division
from
__future__
import
unicode_literals
from
__future__
import
print_function
from
__future__
import
absolute_import
from
io
import
open
from
future
import
standard_library
standard_library
.
install_aliases
()
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/windIO.py
+
8
−
8
View file @
61b7a249
...
...
@@ -9,7 +9,7 @@ from __future__ import division
from
__future__
import
unicode_literals
from
__future__
import
absolute_import
from
builtins
import
dict
from
io
import
open
from
io
import
open
as
opent
from
builtins
import
range
from
builtins
import
str
from
builtins
import
int
...
...
@@ -175,7 +175,7 @@ class LoadResults(object):
try
:
# open file, read and close
go_sel
=
os
.
path
.
join
(
self
.
file_path
,
self
.
file_name
+
'
.sel
'
)
FILE
=
open
(
go_sel
,
"
r
"
)
FILE
=
open
t
(
go_sel
,
"
r
"
)
self
.
lines
=
FILE
.
readlines
()
FILE
.
close
()
self
.
error_msg
=
'
none
'
...
...
@@ -1120,7 +1120,7 @@ def ReadOutputAtTime(fname):
command.
"""
# because the formatting is really weird, we need to sanatize it a bit
with
open
(
fname
,
'
r
'
)
as
f
:
with
open
t
(
fname
,
'
r
'
)
as
f
:
# read the header from line 3
f
.
readline
()
f
.
readline
()
...
...
@@ -1159,7 +1159,7 @@ def ReadEigenBody(fname, debug=False):
#Body data for body number : 3 with the name :nacelle
#Results: fd [Hz] fn [Hz] log.decr [%]
#Mode nr: 1: 1.45388E-21 1.74896E-03 6.28319E+02
FILE
=
open
(
fname
)
FILE
=
open
t
(
fname
)
lines
=
FILE
.
readlines
()
FILE
.
close
()
...
...
@@ -1257,7 +1257,7 @@ def ReadEigenStructure(file_path, file_name, debug=False, max_modes=500):
#8 Mode nr: 1: 3.58673E+00 3.58688E+00 5.81231E+00
# Mode nr:294: 0.00000E+00 6.72419E+09 6.28319E+02
FILE
=
open
(
os
.
path
.
join
(
file_path
,
file_name
))
FILE
=
open
t
(
os
.
path
.
join
(
file_path
,
file_name
))
lines
=
FILE
.
readlines
()
FILE
.
close
()
...
...
@@ -1482,7 +1482,7 @@ class UserWind(object):
"""
blok
=
0
bloks
=
{}
with
open
(
fname
)
as
f
:
with
open
t
(
fname
)
as
f
:
for
i
,
line
in
enumerate
(
f
.
readlines
()):
if
line
.
strip
()[
0
]
==
'
#
'
and
blok
>
0
:
bloks
[
blok
]
=
i
...
...
@@ -1527,7 +1527,7 @@ class UserWind(object):
'
nr_vert: %i
'
%
(
str
(
u
.
shape
),
nr_hor
,
nr_vert
))
# and create the input file
with
open
(
fname
,
'
w
'
)
as
f
:
with
open
t
(
fname
,
'
w
'
)
as
f
:
f
.
write
(
'
# User defined shear file
\n
'
)
f
.
write
(
'
%i %i # nr_hor (v), nr_vert (w)
\n
'
%
(
nr_hor
,
nr_vert
))
h1
=
'
normalized with U_mean, nr_hor (v) rows, nr_vert (w) columns
'
...
...
@@ -1827,7 +1827,7 @@ class Bladed(object):
windows so Western-European windows encoding is a safe bet.
"""
with
codecs
.
open
(
fname
,
'
r
'
,
enc
)
as
f
:
with
codecs
.
open
t
(
fname
,
'
r
'
,
enc
)
as
f
:
lines
=
f
.
readlines
()
nrl
=
len
(
lines
)
if
chans
is
None
and
iters
is
None
:
...
...
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