From 4168d11ee48753077b2cbf3d6f9490be65d16633 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Thu, 15 Apr 2021 12:29:32 -0500 Subject: [PATCH] keep only < 273 for both icing and no-icing regions --- modules/icing/pirep_goes.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index 502527b8..0d81a28c 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -1220,3 +1220,25 @@ def run_mean_std(check_cloudy=False, no_icing_to_icing_ratio=5): [h5f.close() for h5f in no_ice_h5f_lst] return mean_dct, std_dct + + +def split_data(num_obs, perc=0.2, skip=1): + idxs = np.arange(num_obs) + idxs = list(idxs) + + num_test = int(num_obs * perc) + skip = int(num_obs / num_test) + + test_idxs = idxs[::skip] + + test_set = set(test_idxs) + train_set = (set(idxs)).difference(test_set) + train_idxs = list(train_set) + + test_idxs = np.array(test_idxs) + train_idxs = np.array(train_idxs) + + np.random.shuffle(test_idxs) + np.random.shuffle(train_idxs) + + return train_idxs[::skip], test_idxs[::skip] -- GitLab