Skip to content
Snippets Groups Projects
Commit 512c1dc0 authored by tomrink's avatar tomrink
Browse files

add method to scale data

parent d521effb
No related branches found
No related tags found
No related merge requests found
......@@ -405,6 +405,29 @@ def normalize(data, param, mean_std_dict, add_noise=False, noise_scale=1.0, seed
return data
def scale(data, param, mean_std_dict):
if mean_std_dict.get(param) is None:
return data
shape = data.shape
data = data.flatten()
mean, std, lo, hi = mean_std_dict.get(param)
data -= mean
data /= std
data -= lo
data /= (hi - lo)
not_valid = np.isnan(data)
data[not_valid] = 0
data = np.reshape(data, shape)
return data
f = open(ancillary_path+'geos_crs_goes16_FD.pkl', 'rb')
geos_goes16_fd = pickle.load(f)
f.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment