Skip to content
Snippets Groups Projects
Commit f9f0bc20 authored by Sebastian Müller's avatar Sebastian Müller 🐈
Browse files

Adapter: remove ._info artefacts from adapters

parent 6d964711
No related branches found
No related tags found
1 merge request!286Add mask to Info object
Pipeline #249620 failed with stages
in 2 minutes and 40 seconds
"""
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
......
"""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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment