Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
toarstats
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
esde
toar-public
toarstats
Commits
0381881f
Commit
0381881f
authored
9 months ago
by
Max Lensing
Browse files
Options
Downloads
Patches
Plain Diff
bugfix create_reference_series and calc_data_capture, updated toarstats to 0.6.2
parent
1992fa9c
No related branches found
No related tags found
1 merge request
!14
Max version 0.6.2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+6
-0
6 additions, 0 deletions
CHANGELOG.md
toarstats/metrics/stats_utils.py
+15
-7
15 additions, 7 deletions
toarstats/metrics/stats_utils.py
with
21 additions
and
7 deletions
CHANGELOG.md
+
6
−
0
View file @
0381881f
# Changelog
All notable changes to this project will be documented in this file.
## v0.6.2 - 2024-07-22 - bugfixes
### general:
*
corrected calc_data_capture when using custom sampling
*
updated reference_series creation to correct minute-offset
## v0.6.1 - 2024-07-15 - bugfixes
### general:
...
...
This diff is collapsed.
Click to expand it.
toarstats/metrics/stats_utils.py
+
15
−
7
View file @
0381881f
...
...
@@ -113,9 +113,15 @@ def calc_data_capture(ser, ref, sampling, how, mincount=0, minfrac=None,
:return: A series with the data capture fraction
"""
ser_tmp
=
ser
.
resample
(
sampling
).
count
()
fcov
=
ser_tmp
/
ref
.
resample
(
sampling
).
count
()
return
fcov
.
reindex
(
ser_tmp
.
index
)
if
sampling
==
"
100YS
"
:
ser_tmp
=
ser
.
resample
(
sampling
).
count
().
values
fcov
=
ser_tmp
/
ref
.
resample
(
sampling
).
count
().
values
data_capture
=
pd
.
Series
([
fcov
[
0
]],
index
=
[
ref
.
index
[
0
].
round
(
'
H
'
)],
name
=
"
data_capture
"
)
else
:
ser_tmp
=
ser
.
resample
(
sampling
).
count
()
fcov
=
ser_tmp
/
ref
.
resample
(
sampling
).
count
()
data_capture
=
fcov
.
reindex
(
ser_tmp
.
index
)
return
data_capture
def
create_reference_series
(
index
,
daterange
=
None
):
...
...
@@ -131,12 +137,14 @@ def create_reference_series(index, daterange=None):
the earliest given year to the ending of the latest given
year and filled with zeros
"""
min_date
=
index
.
min
()
max_date
=
index
.
max
()
if
daterange
:
start_date
=
daterange
.
split
(
"
,
"
)[
0
]
end_date
=
daterange
.
split
(
"
,
"
)[
1
]
start_date
=
pd
.
to_datetime
(
daterange
.
split
(
"
,
"
)[
0
])
start_date
=
start_date
.
replace
(
minute
=
min_date
.
minute
)
end_date
=
pd
.
to_datetime
(
daterange
.
split
(
"
,
"
)[
1
])
end_date
=
end_date
.
replace
(
minute
=
max_date
.
minute
)
else
:
min_date
=
index
.
min
()
max_date
=
index
.
max
()
start_date
=
f
"
{
min_date
.
year
}
-01-01 00:
{
min_date
.
minute
}
"
end_date
=
f
"
{
max_date
.
year
}
-12-31 23:
{
max_date
.
minute
}
"
reference_index
=
pd
.
date_range
(
start
=
start_date
,
end
=
end_date
,
freq
=
"
h
"
)
...
...
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