Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VILLASdataprocessing
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASdataprocessing
Commits
d6515b99
Commit
d6515b99
authored
7 years ago
by
Bichen Li
Browse files
Options
Downloads
Patches
Plain Diff
Replace read_NEPLAN.py
parent
22131eef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/NEPLAN/read_NEPLAN.py
+28
-5
28 additions, 5 deletions
examples/NEPLAN/read_NEPLAN.py
with
28 additions
and
5 deletions
examples/NEPLAN/read_NEPLAN.py
+
28
−
5
View file @
d6515b99
import
re
from
dataprocessing.readtools
import
*
from
dataprocessing.plottools
import
*
import
matplotlib.pyplot
as
plt
def
readsim
(
file_name
,
timeseries_names
=
None
,
is_regex
=
False
):
str_tmp
=
open
(
file_name
,
"
r
"
)
low
=
0
...
...
@@ -9,6 +11,8 @@ def readsim(file_name,timeseries_names=None, is_regex=False):
seq
=
[]
value
=
[]
i
=
0
namelist
=
[
'
U
'
,
'
ANGLEU
'
,
'
P
'
,
'
Q
'
,
'
I
'
,
'
ANGLEI
'
]
timeseries
=
[]
isfloat
=
re
.
compile
(
r
'
^[-+]?[0-9]+\.[0-9]+$
'
)
for
line
in
str_tmp
.
readlines
():
line
=
line
.
replace
(
"
,
"
,
"
.
"
)
...
...
@@ -26,11 +30,30 @@ def readsim(file_name,timeseries_names=None, is_regex=False):
else
:
value
.
append
(
line
[
low
:
high
])
else
:
# NONE
value
.
append
(
r
'
#
'
)
value
.
append
(
r
'
#
'
)
#No value, set as #
low
=
high
+
1
high
+=
1
if
flag
is
False
:
dic
[
i
]
=
dict
(
zip
(
seq
,
value
))
i
+=
1
if
value
[
0
]
is
not
'
0
'
:
nameindex
=
[]
for
m
in
range
(
5
):
nameindex
.
append
(
seq
[
1
]
+
'
.
'
+
seq
[
2
]
+
'
.
'
+
namelist
[
m
])
if
timeseries_names
is
None
and
is_regex
is
False
:
for
m
in
range
(
5
):
timeseries
.
append
(
TimeSeries
(
nameindex
[
m
],
0
,
value
[
m
+
6
]))
elif
is_regex
is
True
:
# Read in variables which match with regex
p
=
re
.
compile
(
timeseries_names
)
for
m
in
range
(
5
):
if
p
.
search
(
nameindex
[
m
]):
timeseries
.
append
(
TimeSeries
(
nameindex
[
m
],
0
,
value
[
m
+
6
]))
else
:
# Read in specified time series
for
m
in
range
(
5
):
if
timeseries_names
is
namelist
[
m
]:
timeseries
.
append
(
TimeSeries
(
nameindex
[
m
],
0
,
value
[
m
+
6
]))
flag
=
False
dic
[
i
]
=
dict
(
zip
(
seq
,
value
))
i
+=
1
str_tmp
.
close
()
return
dic
\ No newline at end of file
return
dic
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