Commit 9308de5d authored by lukas leufen's avatar lukas leufen

Merge branch 'felix_issue152_reimplement-interpolation' into...

Merge branch 'felix_issue152_reimplement-interpolation' into 'lukas_issue144_feat_workflow-with-advanced-data-handling'

Resolve "reimplement interpolation in station class"

See merge request !132
parents 7f4ee48c 6bc2d2db
Pipeline #42002 passed with stages
in 5 minutes and 52 seconds
......@@ -40,6 +40,7 @@ class StationPrep(AbstractStationPrep):
def __init__(self, station, data_path, statistics_per_var, station_type, network, sampling,
target_dim, target_var, time_dim, window_history_size, window_lead_time,
interpolation_limit: int = 0,
overwrite_local_data: bool = False, transformation=None, store_data_locally: bool = True,
min_length: int = 0, start=None, end=None, **kwargs):
super().__init__() # path, station, statistics_per_var, transformation, **kwargs)
......@@ -56,6 +57,7 @@ class StationPrep(AbstractStationPrep):
self.time_dim = time_dim
self.window_history_size = window_history_size
self.window_lead_time = window_lead_time
self.interpolation_limit = interpolation_limit
self.overwrite_local_data = overwrite_local_data
self.store_data_locally = store_data_locally
self.min_length = min_length
......@@ -100,7 +102,8 @@ class StationPrep(AbstractStationPrep):
f"station_type='{self.station_type}', network='{self.network}', " \
f"sampling='{self.sampling}', target_dim='{self.target_dim}', target_var='{self.target_var}', " \
f"time_dim='{self.time_dim}', window_history_size={self.window_history_size}, " \
f"window_lead_time={self.window_lead_time}, overwrite_local_data={self.overwrite_local_data}, " \
f"window_lead_time={self.window_lead_time}, interpolation_limit={self.interpolation_limit}, " \
f"overwrite_local_data={self.overwrite_local_data}, " \
f"transformation={self._print_transformation_as_string}, **{self.kwargs})"
@property
......@@ -158,7 +161,11 @@ class StationPrep(AbstractStationPrep):
self.make_samples()
def setup_samples(self):
"""
Setup samples. This method prepares and creates samples X, and labels Y.
"""
self.load_data()
self.interpolate(dim=self.time_dim, limit=self.interpolation_limit)
if self.transformation is not None:
self.call_transform()
self.make_samples()
......@@ -659,6 +666,7 @@ if __name__ == "__main__":
statistics_per_var=statistics_per_var, station_type='background',
network='UBA', sampling='daily', target_dim='variables', target_var='o3',
time_dim='datetime', window_history_size=7, window_lead_time=3,
interpolation_limit=0
) # transformation={'method': 'standardise'})
# sp.set_transformation({'method': 'standardise', 'mean': sp.mean+2, 'std': sp.std+1})
sp2 = StationPrep(data_path='/home/felix/PycharmProjects/mlt_new/data/', station='DEBY122',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment