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
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
Admin message
The Gitlab server is succesfully updated to version 17.10.3
Show more breadcrumbs
Frederik Zahle
WindEnergyToolbox
Commits
44df1b4b
Commit
44df1b4b
authored
8 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
sort by Excel file name when constructing DLC opt_tags,
revert commit
0340b1b5
parent
2705feb7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/prepost/dlcdefs.py
+16
-6
16 additions, 6 deletions
wetb/prepost/dlcdefs.py
wetb/prepost/misc.py
+4
-5
4 additions, 5 deletions
wetb/prepost/misc.py
with
20 additions
and
11 deletions
wetb/prepost/dlcdefs.py
+
16
−
6
View file @
44df1b4b
...
...
@@ -240,8 +240,8 @@ def tags_defaults(master):
return
master
def
excel_stabcon
(
proot
,
fext
=
'
xlsx
'
,
pignore
=
None
,
sheet
=
0
,
pinclude
=
None
,
silent
=
False
):
def
excel_stabcon
(
proot
,
fext
=
'
xlsx
'
,
pignore
=
None
,
pinclude
=
None
,
sheet
=
0
,
silent
=
False
):
"""
Read all MS Excel files that hold load case definitions according to
the team STABCON definitions. Save each case in a list according to the
...
...
@@ -251,6 +251,9 @@ def excel_stabcon(proot, fext='xlsx', pignore=None, sheet=0,
are added to be compatible with the tag convention in the Simulations
module.
The opt_tags case list is sorted according to the Excel file names, and
follows the same ordering as in each of the different Excel files.
Parameters
----------
...
...
@@ -272,25 +275,32 @@ def excel_stabcon(proot, fext='xlsx', pignore=None, sheet=0,
Name or index of the Excel sheet to be considered. By default, the
first sheet (index=0) is taken.
Returns
-------
opt_tags : list of dicts
A list of case dictionaries, where each case dictionary holds all
the tag/value key pairs for a single given case.
"""
if
not
silent
:
print
(
'
looking for DLC spreadsheet definitions at:
'
)
print
(
proot
)
d
f_list
=
misc
.
read_excel_files
(
proot
,
fext
=
fext
,
pignore
=
pignore
,
d
ict_dfs
=
misc
.
read_excel_files
(
proot
,
fext
=
fext
,
pignore
=
pignore
,
sheet
=
sheet
,
pinclude
=
pinclude
,
silent
=
silent
)
if
not
silent
:
print
(
'
found %i Excel file(s),
'
%
len
(
d
f_list
),
end
=
''
)
print
(
'
found %i Excel file(s),
'
%
len
(
d
ict_dfs
),
end
=
''
)
k
=
0
for
df
in
d
f_list
:
for
df
in
d
ict_dfs
:
k
+=
len
(
df
)
if
not
silent
:
print
(
'
in which a total of %s cases are defined.
'
%
k
)
opt_tags
=
[]
for
(
dlc
,
df
)
in
viewitems
(
d
f_list
):
for
(
dlc
,
df
)
in
sorted
(
viewitems
(
d
ict_dfs
)
):
# replace ';' with False, and Nan(='') with True
# this is more easy when testing for the presence of stuff compared
# to checking if a value is either True/False or ''/';'
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/misc.py
+
4
−
5
View file @
44df1b4b
...
...
@@ -716,17 +716,16 @@ def read_excel_files(proot, fext='xlsx', pignore=None, sheet=0,
Returns
-------
df_list : list
A list of pandas DataFrames. Each DataFrame corresponds to the
contents of a single Excel file that was found in proot or one of
its sub-directories
df_list : dictionary
A dictionary with the Excel file name (excluding
'
fext
'
) as key, and
the corresponding pandas DataFrame as value.
"""
df_list
=
{}
# find all dlc defintions in the subfolders
for
root
,
dirs
,
files
in
os
.
walk
(
proot
):
for
file_name
in
sorted
(
files
)
:
for
file_name
in
files
:
if
not
file_name
.
split
(
'
.
'
)[
-
1
]
==
fext
:
continue
f_target
=
os
.
path
.
join
(
root
,
file_name
)
...
...
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