Skip to content
Snippets Groups Projects
Commit 928d4448 authored by tomrink's avatar tomrink
Browse files

remove old code, add some new code

parent 6723350c
Branches
No related tags found
No related merge requests found
......@@ -1326,12 +1326,31 @@ def normalize(data, param, mean_std_dict):
return data
def test(filename, skip=1):
h5f = h5py.File(filename, 'r')
time = h5f['time']
intsty = h5f['icing_intensity']
lon_space = np.linspace(-180, 180, 361)
lat_space = np.linspace(-90, 90, 181)
trn_idxs, tst_idxs = split_data(time.shape[0], skip=skip)
print(np.histogram(intsty[trn_idxs], bins=7))
print(np.histogram(intsty[tst_idxs], bins=7))
def spatial_filter(icing_dict):
keys = icing_dict.keys()
grd_x_hi = lon_space.shape[0] - 1
grd_y_hi = lat_space.shape[0] - 1
for key in keys:
grd_bins = np.full((lat_space.shape[0], lon_space.shape[0]), 0)
tup = icing_dict.get(key)
lat = tup[0]
lon = tup[1]
lon_idx = np.searchsorted(lon_space, lon)
lat_idx = np.searchsorted(lat_space, lat)
if lon_idx < 0 or lon_idx > grd_x_hi:
continue
if lat_idx < 0 or lat_idx > grd_y_hi:
continue
grd_bins[lat_idx, lon_idx] += 1
return grd_bins
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment