Skip to content
Snippets Groups Projects
Commit ca36674a authored by lukas leufen's avatar lukas leufen
Browse files

added corresponding test

parent 3c05a5bd
No related branches found
No related tags found
3 merge requests!90WIP: new release update,!89Resolve "release branch / CI on gpu",!68Resolve "Minimal sample size in train-, val, test-set"
Pipeline #31759 passed
......@@ -354,7 +354,6 @@ class DataPrep(object):
intersect = reduce(np.intersect1d, (non_nan_history.coords[dim].values, non_nan_label.coords[dim].values, non_nan_observation.coords[dim].values))
min_length = self.kwargs.get("min_length", 0)
length = len(intersect)
if len(intersect) < max(min_length, 1):
self.history = None
self.label = None
......
......@@ -287,6 +287,14 @@ class TestDataPrep:
assert remaining_len == data.label.datetime.shape
assert remaining_len == data.observation.datetime.shape
def test_remove_nan_too_short(self, data):
data.kwargs["min_length"] = 4000 # actual length of series is 3940
data.make_history_window('variables', -12, 'datetime')
data.make_labels('variables', 'o3', 'datetime', 3)
data.make_observation('variables', 'o3', 'datetime')
data.remove_nan('datetime')
assert not any([data.history, data.label, data.observation])
def test_create_index_array(self, data):
index_array = data.create_index_array('window', range(1, 4))
assert np.testing.assert_array_equal(index_array.data, [1, 2, 3]) is None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment