Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent frontogenesis from returning nans #3696

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 19, 2024

  1. Prevent frontogenesis from returning nans

    Fixes #3768 by making sure the argument to the arcsin function is
    valid.
    
    Previously, frontogenesis could return nans when there was a constant
    theta field (division by zero would occur) or if round-off error
    resulted in the argument to arcsin being slightly outside the valid
    domain of the function (-1 to 1).  In this commit, edits are made to
    set points to zero where nans occur due to division by zero (the
    frontogenesis is zero when the magnitude of the theta gradient is zero
    anyway) and to use np.clip to ensure the argument to arcsin is valid.
    
    I could not come up with a simplified test case that triggers the
    round-off error issue with arcsin, but I do include a test case for
    the constant theta situation.  Because the test case results in a
    division by zero by design, it is currently failing since that
    triggers a RuntimeWarning.
    sgdecker committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    12f4285 View commit details
    Browse the repository at this point in the history