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
4cd98d45
Commit
4cd98d45
authored
1 year ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
delete statistic group if exists when trying to add in gtsdf
parent
0c483e43
No related branches found
No related tags found
1 merge request
!238
delete statistic group if exists when trying to add in gtsdf
Pipeline
#51953
failed
1 year ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/gtsdf/gtsdf.py
+7
-4
7 additions, 4 deletions
wetb/gtsdf/gtsdf.py
with
7 additions
and
4 deletions
wetb/gtsdf/gtsdf.py
+
7
−
4
View file @
4cd98d45
...
...
@@ -93,7 +93,7 @@ def load(filename, dtype=None):
finally
:
try
:
f
.
close
()
except
:
except
BaseException
:
pass
...
...
@@ -129,7 +129,7 @@ def _load_info(f):
info
[
'
attribute_descriptions
'
]
=
[
v
.
decode
(
'
latin1
'
)
for
v
in
f
[
'
attribute_descriptions
'
]]
try
:
info
[
'
dtype
'
]
=
f
[
block_name_fmt
%
0
][
'
data
'
].
dtype
except
:
except
BaseException
:
pass
return
info
...
...
@@ -408,7 +408,7 @@ def append_block(filename, data, **kwargs):
except
Exception
:
try
:
f
.
close
()
except
:
except
BaseException
:
pass
raise
...
...
@@ -443,8 +443,11 @@ def _get_statistic(time, data, statistics=['min', 'mean', 'max', 'std', 'eq3', '
return
np
.
array
([
get_stat
(
stat
)
for
stat
in
statistics
]).
T
def
_add_statistic_data
(
file
,
stat_data
,
statistics
=
[
'
min
'
,
'
mean
'
,
'
max
'
,
'
std
'
,
'
eq3
'
,
'
eq4
'
,
'
eq6
'
,
'
eq8
'
,
'
eq10
'
,
'
eq12
'
]):
def
_add_statistic_data
(
file
,
stat_data
,
statistics
=
[
'
min
'
,
'
mean
'
,
'
max
'
,
'
std
'
,
'
eq3
'
,
'
eq4
'
,
'
eq6
'
,
'
eq8
'
,
'
eq10
'
,
'
eq12
'
]):
f
=
h5py
.
File
(
file
,
"
a
"
)
if
'
Statistic
'
in
f
:
del
f
[
"
Statistic
"
]
stat_grp
=
f
.
create_group
(
"
Statistic
"
)
stat_grp
.
create_dataset
(
"
statistic_names
"
,
data
=
np
.
array
([
v
.
encode
(
'
utf-8
'
)
for
v
in
statistics
]))
stat_grp
.
create_dataset
(
"
statistic_data
"
,
data
=
stat_data
.
astype
(
float
))
...
...
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