diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py index 194700cc64e0fe5a8871e9c60c94e9c44f096018..2f1574f8f88c8e010243d55494476873b5aaacb4 100644 --- a/modules/util/viirs_l1b_l2.py +++ b/modules/util/viirs_l1b_l2.py @@ -51,8 +51,8 @@ emis_params = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13 # data_params = refl_params + emis_params # data_params = emis_params -l2_params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'cloud_fraction'] -# l2_params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'refl_0_65um_nom', 'cloud_fraction'] +# l2_params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'cloud_fraction'] +l2_params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'refl_0_65um_nom', 'cloud_fraction'] label_params = l2_params data_params = l2_params @@ -126,11 +126,12 @@ def run_all(directory, out_directory, day_night='ANY'): except Exception as e: print(e) data_h5f.close() - #label_h5f.close() + # label_h5f.close() continue + print(data_f) data_h5f.close() - #label_h5f.close() + # label_h5f.close() # if len(data_tiles) == 0 or len(label_tiles) == 0: # continue @@ -153,25 +154,26 @@ def run_all(directory, out_directory, day_night='ANY'): if f_cnt == 5: f_cnt = 0 - # label_valid = np.stack(label_valid_tiles) + num_valid_samples = 0 + if len(data_valid_tiles) > 0: + # label_valid = np.stack(label_valid_tiles) + data_valid = np.stack(data_valid_tiles) + np.save(out_directory + 'data_valid_' + str(cnt), data_valid) + # np.save(out_directory+'label_valid_' + str(cnt), label_valid) + num_valid_samples = data_valid.shape[0] + # label_train = np.stack(label_train_tiles) - data_valid = np.stack(data_valid_tiles) + # np.save(out_directory+'label_train_' + str(cnt), label_train) 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) + num_train_samples = data_train.shape[0] 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) + print(' num_train_samples, num_valid_samples: ', num_train_samples, num_valid_samples) total_num_train_samples += num_train_samples total_num_valid_samples += num_valid_samples