From c117f85456e67bc877630bfeed6a3450f871fae6 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Sat, 4 Jun 2022 19:41:49 -0500 Subject: [PATCH] minor... --- modules/util/viirs_l1b_l2.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py index 071fa448..0e79805d 100644 --- a/modules/util/viirs_l1b_l2.py +++ b/modules/util/viirs_l1b_l2.py @@ -125,7 +125,7 @@ def run_all(directory, out_directory): np.save(out_directory+'label_valid_' + str(cnt), label_valid) -def run(data_h5f, label_h5f, data_tiles, label_tiles, factor=2): +def run(data_h5f, label_h5f, data_tiles, label_tiles, factor=2, border=9): if label_h5f is None: label_h5f = data_h5f @@ -168,7 +168,6 @@ def run(data_h5f, label_h5f, data_tiles, label_tiles, factor=2): i_skip = 3 * mod_tile_width i_start = int(mod_num_pixels / 2) - int((num_keep_x_tiles * 3 * mod_tile_width) / 2) - border = 9 num_keep_y_tiles = 16 j_skip = 3 * mod_tile_width for j in range(num_keep_y_tiles): @@ -181,7 +180,15 @@ def run(data_h5f, label_h5f, data_tiles, label_tiles, factor=2): i_m = i_c + border i_i = i_m * factor - nda = mod_data[:, j_m-border:j_m + mod_tile_width+border, i_m:i_m + mod_tile_width] + j_stop = j_m + mod_tile_width + border + if j_stop > mod_num_lines - 1: + continue + + i_stop = i_m + mod_tile_width + border + if i_stop > mod_num_pixels - 1: + continue + + nda = mod_data[:, j_m-border:j_stop, i_m-border:i_stop] data_tiles.append(nda) nda = img_data[:, j_i:j_i + img_tile_width, i_i:i_i + img_tile_width] -- GitLab