Skip to content

array_thresh baz estimate range issue #38

Description

@liamtoney

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions