Пример #1
0
def _get_test_list(fhc_vars, weights, radar_data, sets, varlist, weight_sum,
                   pol_flag, use_temp, method, sz):
    """
    Master loop to compute HID values for each species ('test' & 'test_list').
    Depending on method used, approach is modfied.
    Currently disabling testing as it gets spoofed by bad data. Letting the
    calculations continue then mask out the bad data using other methods.
    TO DO: Change poor naming scheme for variables 'test' and 'test_list']
    """
    # TJL - Check order of if statements
    test_list = []
    #print('Using fortran hid_beta!')
    for c in range(len(sets['DZ']['m'])):
        if 'hybrid' in method:  # Hybrid emphasizes Z and T extra HARD
            if pol_flag:
                test = _calculate_test(fhc_vars, weights, radar_data, sets,
                                       varlist, weight_sum, c, sz)
                # if test.max() > 1:  # Max of test should never be > 1
                #     print 'Fail loc 1, test.max() =', test.max()
                #     return None
            if use_temp:
                if pol_flag:
                    # *= multiplies by new value and stores in test
                    mdum = hid_beta_f(sz, radar_data['T'], sets['T']['a'][c],
                                      sets['T']['b'][c], sets['T']['m'][c])
                    test = mdum * test
                    # print 'in loc 2'
                    # if test.max() > 1: #Maximum of test should never be > 1
                    #     print 'Fail loc 2, test.max() =', test.max()
                    #     return None
                else:
                    test = hid_beta_f(sz, radar_data['T'], sets['T']['a'][c],
                                      sets['T']['b'][c], sets['T']['m'][c])
            if fhc_vars['DZ']:
                if pol_flag or use_temp:
                    test *= hid_beta_f(sz, radar_data['DZ'],
                                       sets['DZ']['a'][c], sets['DZ']['b'][c],
                                       sets['DZ']['m'][c])
                    # if test.max() > 1:  # Max of test should never be > 1
                    #     print 'Fail loc 3, test.max() =', test.max()
                    #     return None
                else:
                    test = hid_beta_f(sz, radar_data['DZ'], sets['DZ']['a'][c],
                                      sets['DZ']['b'][c], sets['DZ']['m'][c])
        elif 'linear' in method:  # Just a giant weighted sum
            if pol_flag:
                test = _calculate_test(fhc_vars, weights, radar_data, sets,
                                       varlist, weight_sum, c, sz)
        test_list.append(test)
    return test_list
Пример #2
0
def _get_test_list(fhc_vars, weights, radar_data, sets, varlist, weight_sum,
                   pol_flag, use_temp, method, sz):
    """
    Master loop to compute HID values for each species ('test' & 'test_list').
    Depending on method used, approach is modfied.
    Currently disabling testing as it gets spoofed by bad data. Letting the
    calculations continue then mask out the bad data using other methods.
    TO DO: Change poor naming scheme for variables 'test' and 'test_list']
    """
    # TJL - Check order of if statements
    test_list = []
    for c in range(len(sets['DZ']['m'])):
        if 'hybrid' in method:  # Hybrid emphasizes Z and T extra HARD
            if pol_flag:
                test = _calculate_test(fhc_vars, weights, radar_data, sets,
                                       varlist, weight_sum, c, sz)
                # if test.max() > 1:  # Max of test should never be > 1
                #     print 'Fail loc 1, test.max() =', test.max()
                #     return None
            if use_temp:
                if pol_flag:
                    # *= multiplies by new value and stores in test
                    test *= hid_beta_f(sz, radar_data['T'], sets['T']['a'][c],
                                       sets['T']['b'][c], sets['T']['m'][c])
                    # print 'in loc 2'
                    # if test.max() > 1: #Maximum of test should never be > 1
                    #     print 'Fail loc 2, test.max() =', test.max()
                    #     return None
                else:
                    test = hid_beta_f(sz, radar_data['T'], sets['T']['a'][c],
                                      sets['T']['b'][c], sets['T']['m'][c])
            if fhc_vars['DZ']:
                if pol_flag or use_temp:
                    test *= hid_beta_f(
                        sz, radar_data['DZ'], sets['DZ']['a'][c],
                        sets['DZ']['b'][c], sets['DZ']['m'][c])
                    # if test.max() > 1:  # Max of test should never be > 1
                    #     print 'Fail loc 3, test.max() =', test.max()
                    #     return None
                else:
                    test = hid_beta_f(sz, radar_data['DZ'], sets['DZ']['a'][c],
                                      sets['DZ']['b'][c], sets['DZ']['m'][c])
        elif 'linear' in method:  # Just a giant weighted sum
            if pol_flag:
                test = _calculate_test(fhc_vars, weights, radar_data, sets,
                                       varlist, weight_sum, c, sz)
        test_list.append(test)
    return test_list
Пример #3
0
def _calculate_test(fhc_vars, weights, radar_data, sets,
                    varlist, weight_sum, c, sz):
    """Loop over every var to get initial value for each HID species 'test'"""
#    test = (np.sum(np.array([fhc_vars[key] * weights[key] *
#                            hid_beta(radar_data[key], sets[key]['a'][c],
#                            sets[key]['b'][c], sets[key]['m'][c])
    test = (np.sum(np.array([fhc_vars[key] * weights[key] *
                            hid_beta_f(sz, radar_data[key], sets[key]['a'][c],
                            sets[key]['b'][c], sets[key]['m'][c])
            for key in varlist if key in radar_data.keys()]),
            axis=0))/weight_sum
    return test
Пример #4
0
def _calculate_test(fhc_vars, weights, radar_data, sets, varlist, weight_sum,
                    c, sz):
    """Loop over every var to get initial value for each HID species 'test'"""
    #    test = (np.sum(np.array([fhc_vars[key] * weights[key] *
    #                            hid_beta(radar_data[key], sets[key]['a'][c],
    #                            sets[key]['b'][c], sets[key]['m'][c])
    test = (np.sum(np.array([
        fhc_vars[key] * weights[key] *
        hid_beta_f(sz, radar_data[key], sets[key]['a'][c], sets[key]['b'][c],
                   sets[key]['m'][c])
        for key in varlist if key in radar_data.keys()
    ]),
                   axis=0)) / weight_sum
    return test