array_processing icon indicating copy to clipboard operation
array_processing copied to clipboard

array_thresh baz estimate range issue

Open liamtoney opened this issue 3 years ago • 0 comments

From @kfmckee:

I found a small issue with array_processing.tools.generic.array_thresh. The back-azimuth estimates are from 0-360, so if az_volc+-az_diff are greater than 360 or less than 0, they are excluded from the sorting process. I wrote up a work around and figured I would share. Not the prettiest, but seems to work.

    if az_volc - az_diff < 0:
        for j in range(np.size(az)):
            if az[j] > 180:
                az[j] = az[j] - 360
        az_good = np.where((az >= az_volc - az_diff) & (az <= az_volc + az_diff))[0]
        for j in range(np.size(az)):
            if az[j] < 0:
                az[j] = az[j] + 360
    elif az_volc + az_diff > 360:
        for j in range(np.size(az)):
            if az[j] < 180:
                az[j] = az[j] + 360
        az_good = np.where((az >= az_volc - az_diff) & (az <= az_volc + az_diff))[0]
        for j in range(np.size(az)):
            if az[j] > 360:
                az[j] = az[j] - 360
    else:
        az_good = np.where((az >= az_volc - az_diff) & (az <= az_volc + az_diff))[0]

liamtoney avatar Apr 07 '22 18:04 liamtoney