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

snapshot...

parent fc869f41
No related branches found
No related tags found
No related merge requests found
...@@ -191,7 +191,6 @@ def run(data_h5f, param_s, tiles, tile_width=64, kernel_size=9, day_night='ANY') ...@@ -191,7 +191,6 @@ def run(data_h5f, param_s, tiles, tile_width=64, kernel_size=9, day_night='ANY')
solzen = get_grid_values(data_h5f, 'solar_zenith_angle', 0, 0, None, num_lines, num_pixels) solzen = get_grid_values(data_h5f, 'solar_zenith_angle', 0, 0, None, num_lines, num_pixels)
grd_s = [] grd_s = []
for param in param_s: for param in param_s:
fill_value, fill_value_name = get_fill_attrs(param) fill_value, fill_value_name = get_fill_attrs(param)
try: try:
...@@ -200,38 +199,31 @@ def run(data_h5f, param_s, tiles, tile_width=64, kernel_size=9, day_night='ANY') ...@@ -200,38 +199,31 @@ def run(data_h5f, param_s, tiles, tile_width=64, kernel_size=9, day_night='ANY')
except Exception as e: except Exception as e:
print(e) print(e)
return return
data = np.stack(grd_s) data = np.stack(grd_s)
tile_width + 2 * border
num_keep_x_tiles = 4 num_keep_x_tiles = 4
#num_keep_x_tiles = 1 i_skip = tile_width
i_skip = num_keep_x_tiles * tile_width j_skip = tile_width
j_skip = 1 * tile_width
i_start = int(num_pixels / 2) - int((num_keep_x_tiles * tile_width) / 2) i_start = int(num_pixels / 2) - int((num_keep_x_tiles * tile_width) / 2)
num_keep_y_tiles = 24 num_keep_y_tiles = int(num_lines / tile_width) - 1
for j in range(num_keep_y_tiles): for j in range(num_keep_y_tiles):
j_c = j * j_skip j_a = j * j_skip
j_m = j_c + border j_b = j_a + tile_width
for i in range(num_keep_x_tiles): for i in range(num_keep_x_tiles):
i_c = i * i_skip + i_start i_a = i_start + i * i_skip
i_m = i_c + border i_b = i_a + tile_width
j_stop = j_m + tile_width + border
if j_stop > num_lines - 1:
continue
i_stop = i_m + tile_width + border
if i_stop > num_pixels - 1:
continue
if day_night == 'DAY' and not is_day(solzen[j_m-border:j_stop, i_m-border:i_stop]): if day_night == 'DAY' and not is_day(solzen[j_a:j_b, i_a:i_b]):
continue continue
elif day_night == 'NIGHT' and is_day(solzen[j_m-border:j_stop, i_m-border:i_stop]): elif day_night == 'NIGHT' and is_day(solzen[j_a:j_b, i_a:i_b]):
continue continue
nda = data[:, j_m-border:j_stop, i_m-border:i_stop] nda = data[:, j_a:j_b, i_a:i_b]
if not keep_tile(param_s, nda): if not keep_tile(param_s, nda):
continue continue
tiles.append(nda) tiles.append(nda)
......
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