Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FINAM
finam
Commits
f9f0bc20
Commit
f9f0bc20
authored
4 months ago
by
Sebastian Müller
🐈
Browse files
Options
Downloads
Patches
Plain Diff
Adapter: remove ._info artefacts from adapters
parent
6d964711
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!286
Add mask to Info object
Pipeline
#249620
failed with stages
in 2 minutes and 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/finam/adapters/base.py
+2
-8
2 additions, 8 deletions
src/finam/adapters/base.py
src/finam/adapters/time_integration.py
+1
-5
1 addition, 5 deletions
src/finam/adapters/time_integration.py
with
3 additions
and
13 deletions
src/finam/adapters/base.py
+
2
−
8
View file @
f9f0bc20
"""
Basic data transformation adapters.
"""
import
numpy
as
np
from
..data.grid_spec
import
NoGrid
...
...
@@ -123,7 +124,6 @@ class ValueToGrid(Adapter):
def
__init__
(
self
,
grid
):
super
().
__init__
()
self
.
grid
=
grid
self
.
_info
=
None
def
_get_data
(
self
,
time
,
target
):
"""
Get the output
'
s data-set for the given time.
...
...
@@ -139,12 +139,7 @@ class ValueToGrid(Adapter):
data-set for the requested time.
"""
value
=
self
.
pull_data
(
time
,
target
)
return
quantify
(
np
.
full
(
self
.
_info
.
grid
.
data_shape
,
get_magnitude
(
value
),
dtype
=
value
.
dtype
),
get_units
(
value
),
)
return
np
.
full
(
self
.
info
.
grid_shape
,
get_magnitude
(
value
))
def
_get_info
(
self
,
info
):
up_info
=
info
.
copy_with
(
grid
=
NoGrid
())
...
...
@@ -157,7 +152,6 @@ class ValueToGrid(Adapter):
f
"
Grid specifications don
'
t match. Target has
{
info
.
grid
}
, expected
{
out_info
.
grid
}
"
)
self
.
_info
=
out_info
return
out_info
...
...
This diff is collapsed.
Click to expand it.
src/finam/adapters/time_integration.py
+
1
−
5
View file @
f9f0bc20
"""
Adapters for time integration
"""
from
abc
import
ABC
from
datetime
import
timedelta
...
...
@@ -14,7 +15,6 @@ class TimeIntegrationAdapter(TimeCachingAdapter, ABC):
def
__init__
(
self
):
super
().
__init__
()
self
.
_prev_time
=
None
self
.
_info
=
None
def
_source_updated
(
self
,
time
):
"""
Informs the input that a new output is available.
...
...
@@ -107,7 +107,6 @@ class AvgOverTime(TimeIntegrationAdapter):
super
().
__init__
()
self
.
_prev_time
=
None
self
.
_step
=
step
self
.
_info
=
None
def
_interpolate
(
self
,
time
):
if
len
(
self
.
data
)
==
1
:
...
...
@@ -238,8 +237,6 @@ class SumOverTime(TimeIntegrationAdapter):
self
.
_per_time
=
per_time
self
.
_initial_interval
=
initial_interval
self
.
_info
=
None
def
_interpolate
(
self
,
time
):
if
len
(
self
.
data
)
==
1
or
time
<=
self
.
data
[
0
][
0
]:
if
self
.
_per_time
:
...
...
@@ -307,5 +304,4 @@ class SumOverTime(TimeIntegrationAdapter):
else
:
out_info
=
in_info
.
copy_with
()
self
.
_info
=
out_info
return
out_info
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