diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index d0e6cd3776f3a5a736ae064a3a25fc39a2c6154f..31b5f166a9d84f788839512488ad59f1286e3b91 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -1312,7 +1312,7 @@ def split_data(num_obs, perc=0.2, skip=1, shuffle=True, seed=None): return train_idxs[::skip], test_idxs[::skip] -def normalize(data, param, mean_std_dict): +def normalize(data, param, mean_std_dict, add_noise=False, noise_scale=1.0, seed=None): if mean_std_dict.get(param) is None: return data @@ -1324,6 +1324,12 @@ def normalize(data, param, mean_std_dict): data -= mean data /= std + if add_noise: + if seed is not None: + np.random.seed(seed) + rnd = np.random.normal(loc=0, scale=noise_scale, size=data.size) + data += rnd + not_valid = np.isnan(data) data[not_valid] = 0