예제 #1
0
def adaptive_boundaries_second_prototype(sst, cmc, threshold_min,
                                         threshold_max, threshold_gradient,
                                         radius, window_size, scale,
                                         cold_mask):
    grad_mask, cmc_min = high_gradient_sst(sst_reynolds=cmc,
                                           threshold=threshold_gradient,
                                           radius=radius)
    delta_sst_modified = sst - cmc_min
    mask_to_pass_for_adaptive = cold_mask & (delta_sst_modified <
                                             threshold_min) & grad_mask
    adaptive_mask = adaptive_test(image=delta_sst_modified,
                                  window_size=window_size,
                                  scale=scale,
                                  mask=mask_to_pass_for_adaptive,
                                  threshold=threshold_min)
    # threshold_min = -1.5
    # threshold_max = -0.5
    return adaptive_mask & (delta_sst_modified < threshold_max)
예제 #2
0
    tests_data[test_cold_name + "_static"] = np.zeros((len(files), 256, 256)) > 1.0

land_rad = 10

tests_data["ACSPO_mod" + "_static"] = np.zeros((len(files), 256, 256)) > 1.0
tests_data["GRAD_MASK"] = np.zeros((len(files), 256, 256)) > 1.0

for i in range(len(files)):
    individual_original = tests_data["Individual"][i, :, :]
    sst_reynolds = tests_data["sst_reynolds"][i, :, :]
    sst_regression = tests_data["sst_regression"][i, :, :]
    nan_mask = np.isnan(sst_regression)
    mask_no_land = (mask_around(nan_mask, land_rad)) & (~nan_mask)
    hmask = get_high_gradient(sst_reynolds, threshold=thresh, radius=dilatation_size)
    # other mask
    sst_max, sst_min = high_gradient_sst(sst_reynolds, threshold=thresh, radius=dilatation_size+3)

    cold_mask = cold_masks[files[i]] > 0  #
    mask_to_protect = (tests_data["FULL_BTD_MASK"][i, :, :] > 0) | cold_mask

    non_sst_mask = tests_data["non_sst_mask"][i, :, :]
    tests_data["GRAD_MASK"][i, :, :] = hmask
    if switch_full_btds:
        hmask[:] = True
    Adaptive = ((tests_data["Adaptive"][i, :, :] > 0) & (~hmask))  # it could be that we would need to return hmask

    for test_cold_name in test_names_cold:
        if test_cold_name != "ULST_COLD":
            tests_data[test_cold_name + "_static"][i, :, :] = (cold_mask_by_test[files[i]][test_cold_name] > 0) & hmask
        else:
            tests_data["ULST" + "_static"][i, :, :] = (tests_data["ULST" + "_static"][i, :, :] > 0) | (
예제 #3
0
 print(files[index])
 # print(files_l1bs[0])
 sst, cmc = get_sst_cmc(path_full)
 mask = get_acspo_mask(path_full)
 BT_11 = get_Bt_from_L2P(path_full, "brightness_temp_ch14")
 BT_12 = get_Bt_from_L2P(path_full, "brightness_temp_ch15")
 BT_8 = get_Bt_from_L2P(path_full, "brightness_temp_ch11")
 BT_11_crtm = get_Bt_from_L2P(path_full, "brightness_temp_crtm_ch14")
 BT_12_crtm = get_Bt_from_L2P(path_full, "brightness_temp_crtm_ch15")
 BT_8_crtm = get_Bt_from_L2P(path_full, "brightness_temp_crtm_ch11")
 additional_mask = (BT_7 - BT_11 > -50)
 bt11_bt12_mask = np.abs((BT_11 - BT_11_crtm) - (BT_12 - BT_12_crtm)) > 0.6
 bt12_bt8_mask = np.abs((BT_11 - BT_11_crtm) - (BT_8 - BT_8_crtm)) > 1.2
 combined_mask = mask | (bt11_bt12_mask & ~np.isnan(sst))
 cmc_max, cmc_min = high_gradient_sst(sst_reynolds=cmc,
                                      threshold=2.0,
                                      radius=12)
 dt_sst = sst - cmc
 dt_sst_min = sst - cmc_min
 dt_sst_max = sst - cmc_max
 dt_sst[dt_sst > 2] = 2.0
 dt_sst[dt_sst < -2] = -2.0
 dt_sst_min[dt_sst_min > 2] = 2.0
 dt_sst_min[dt_sst_min < -2] = -2.0
 dt_sst_max[dt_sst_max > 2] = 2.0
 dt_sst_max[dt_sst_max < -2] = -2.0
 map_cloud = deepcopy(my_cmap)
 map_cloud.set_over((128 / 255.0, 128 / 255.0, 128 / 255.0))
 dt_sst[combined_mask] = 2.1
 dt_sst_min[mask] = 2.1
 dt_sst_max[mask] = 2.1