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
4a8233f0
Commit
4a8233f0
authored
7 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
prepost: fix some weird edge case with path/case_id name from zip-chunks
parent
dce814db
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
wetb/prepost/dlctemplate.py
+18
-3
18 additions, 3 deletions
wetb/prepost/dlctemplate.py
with
18 additions
and
3 deletions
wetb/prepost/dlctemplate.py
+
18
−
3
View file @
4a8233f0
...
@@ -334,6 +334,8 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False,
...
@@ -334,6 +334,8 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False,
# to avoid confusing HAWC2 simulations and Mann64 generator PBS files,
# to avoid confusing HAWC2 simulations and Mann64 generator PBS files,
# MannTurb64 places PBS launch scripts in a "pbs_in_turb" folder
# MannTurb64 places PBS launch scripts in a "pbs_in_turb" folder
mann64
=
sim
.
MannTurb64
(
silent
=
silent
)
mann64
=
sim
.
MannTurb64
(
silent
=
silent
)
mann64
.
walltime
=
'
00:59:59
'
mann64
.
queue
=
'
workq
'
mann64
.
gen_pbs
(
cases
)
mann64
.
gen_pbs
(
cases
)
if
zipchunks
:
if
zipchunks
:
...
@@ -525,6 +527,9 @@ def postpro_node_merge(tqdm=False, zipchunks=False):
...
@@ -525,6 +527,9 @@ def postpro_node_merge(tqdm=False, zipchunks=False):
'
[case_id]
'
,
'
[Case folder]
'
]
'
[case_id]
'
,
'
[Case folder]
'
]
df
=
pd
.
read_hdf
(
fdf
,
'
table
'
)
df
=
pd
.
read_hdf
(
fdf
,
'
table
'
)
# FIXME: why do some cases have a leading ./ (but most do not)?
sel
=
df
[
'
[case_id]
'
].
str
.
startswith
(
'
./
'
)
df
.
loc
[
sel
,
'
[case_id]
'
]
=
df
.
loc
[
sel
,
'
[case_id]
'
].
str
.
replace
(
'
./
'
,
''
,
1
)
# df now has case_id as the path to the statistics file: res/dlc12_xxx/yyy
# df now has case_id as the path to the statistics file: res/dlc12_xxx/yyy
# while df_tags will have just yyy as case_id
# while df_tags will have just yyy as case_id
tmp
=
df
[
'
[case_id]
'
].
str
.
split
(
'
/
'
,
expand
=
True
)
tmp
=
df
[
'
[case_id]
'
].
str
.
split
(
'
/
'
,
expand
=
True
)
...
@@ -535,9 +540,19 @@ def postpro_node_merge(tqdm=False, zipchunks=False):
...
@@ -535,9 +540,19 @@ def postpro_node_merge(tqdm=False, zipchunks=False):
df_stats
=
pd
.
merge
(
df
,
df_tags
,
on
=
[
'
[case_id]
'
])
df_stats
=
pd
.
merge
(
df
,
df_tags
,
on
=
[
'
[case_id]
'
])
# if the merge didn't work due to other misaligned case_id tags, do not
# if the merge didn't work due to other misaligned case_id tags, do not
# overwrite our otherwise ok tables!
# overwrite our otherwise ok tables!
if
len
(
df_stats
)
==
len
(
df
):
if
len
(
df_stats
)
!=
len
(
df
):
df_stats
.
to_hdf
(
fdf
,
'
table
'
,
mode
=
'
w
'
)
print
(
'
failed to merge required tags, something is wrong!
'
)
df_stats
.
to_csv
(
fdf
.
replace
(
'
.h5
'
,
'
.csv
'
))
# find out which cases we lost and why
print
(
'
number of entries lost:
'
,
len
(
df
)
-
len
(
df_stats
))
s_df
=
set
(
df
[
'
[case_id]
'
].
unique
())
s_stats
=
set
(
df_stats
[
'
[case_id]
'
].
unique
())
print
(
'
nr of channels:
'
,
len
(
df
[
'
channel
'
].
unique
()))
print
((
len
(
df
)
-
len
(
df_stats
))
/
len
(
df
[
'
channel
'
].
unique
()))
print
(
'
following case_ids have mysteriously disappeared:
'
)
print
(
s_df
-
s_stats
)
return
df_stats
.
to_hdf
(
fdf
,
'
table
'
,
mode
=
'
w
'
)
df_stats
.
to_csv
(
fdf
.
replace
(
'
.h5
'
,
'
.csv
'
))
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
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