From ab3714332339c56224dea372afa7c7aede6276c8 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Wed, 3 Aug 2022 16:48:01 -0500 Subject: [PATCH] more fixing --- modules/util/viirs_l1b_l2.py | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py index 2d48ed02..d440e5c0 100644 --- a/modules/util/viirs_l1b_l2.py +++ b/modules/util/viirs_l1b_l2.py @@ -105,34 +105,34 @@ def run_all(directory, out_directory): [data_valid_tiles.append(data_tiles[k]) for k in range(n_vld)] [data_train_tiles.append(data_tiles[k]) for k in range(n_vld, num)] - if f_cnt == 10: - cnt += 1 - - #label_valid = np.stack(label_valid_tiles) - #label_train = np.stack(label_train_tiles) - data_valid = np.stack(data_valid_tiles) - data_train = np.stack(data_train_tiles) - - np.save(out_directory+'data_train_' + str(cnt), data_train) - np.save(out_directory+'data_valid_' + str(cnt), data_valid) - #np.save(out_directory+'label_train_' + str(cnt), label_train) - #np.save(out_directory+'label_valid_' + str(cnt), label_valid) - - #label_valid_tiles = [] - #label_train_tiles = [] - data_valid_tiles = [] - data_train_tiles = [] - - num_train_samples = data_train.shape[0] - num_valid_samples = data_valid.shape[0] - print(' file # done: ', cnt) - print('num_train_samples, num_valid_samples: ', num_train_samples, num_valid_samples) - total_num_train_samples += num_train_samples - total_num_test_samples += num_valid_samples - - f_cnt = 0 - else: - f_cnt += 1 + if f_cnt == 10: + cnt += 1 + + #label_valid = np.stack(label_valid_tiles) + #label_train = np.stack(label_train_tiles) + data_valid = np.stack(data_valid_tiles) + data_train = np.stack(data_train_tiles) + + np.save(out_directory+'data_train_' + str(cnt), data_train) + np.save(out_directory+'data_valid_' + str(cnt), data_valid) + #np.save(out_directory+'label_train_' + str(cnt), label_train) + #np.save(out_directory+'label_valid_' + str(cnt), label_valid) + + #label_valid_tiles = [] + #label_train_tiles = [] + data_valid_tiles = [] + data_train_tiles = [] + + num_train_samples = data_train.shape[0] + num_valid_samples = data_valid.shape[0] + print(' file # done: ', cnt) + print('num_train_samples, num_valid_samples: ', num_train_samples, num_valid_samples) + total_num_train_samples += num_train_samples + total_num_test_samples += num_valid_samples + + f_cnt = 0 + else: + f_cnt += 1 # if len(label_train_tiles) == 0 or len(data_train_tiles) == 0: # continue -- GitLab