Skip to content

Fixing OutOfBounds errors on field.eval#2665

Open
erikvansebille wants to merge 2 commits into
Parcels-code:mainfrom
erikvansebille:update_OutOfBounds_codes
Open

Fixing OutOfBounds errors on field.eval#2665
erikvansebille wants to merge 2 commits into
Parcels-code:mainfrom
erikvansebille:update_OutOfBounds_codes

Conversation

@erikvansebille

Copy link
Copy Markdown
Member

Description

In the previous implementation, the GRID_SEARCH_ERROR, LEFT_OUT_OF_BOUNDS and RIGHT_OUT_OF_BOUNDS were negative values, but this could create confusion when a user would call a field.eval() directly. Instead, these constants are now set to very large values

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
    • Describe how you used it (e.g., by pasting your prompt):

In the previous implementation, the GRID_SEARCH_ERROR, LEFT_OUT_OF_BOUNDS and RIGHT_OUT_OF_BOUNDS were negative values, but this could create confusion when a user would then use particles.ei (as negative values are wrapped in the array). See also Parcels-code#2629

@fluidnumericsJoe fluidnumericsJoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! simple and elegant. Also avoids additional filtering stage in the interpolators or in field.eval to drop out particles not found in the mesh.

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Field.eval silently returns wrong values for out-of-domain queries

2 participants