From d5ce6f0f8ca3262445da6e64d32a4acc07cb9fa6 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Fri, 9 Jul 2021 10:35:21 -0500 Subject: [PATCH] minor --- modules/icing/pirep_goes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index d0e6cd37..31b5f166 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 -- GitLab