-
Notifications
You must be signed in to change notification settings - Fork 526
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
added extra error checking on spherical mesh creation #2973
Conversation
@shimwell I have made these changes for my added error checks on the spherical mesh. Could you review them please? |
@paulromano would it be ok to merge this extra check in. Admittedly it will slow down the mesh creation a bit. Do you think the reduction in speed is worth the extra user friendliness? Would it be worth trying a numpy solution to speed things up a bit for the longer arrays? |
Co-authored-by: Jonathan Shimwell <[email protected]>
Thanks for those changes, I've triggered the CI |
CI has passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea here but the implementation is not very efficient. I would recommend using numpy functionality rather than an explicit for loop. You can check for monotonicity of a list/array with:
np.all(np.diff(value) > 0.0)
@shimwell @paulromano Thanks for the response and numpy changes applied! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this improvement, @chrwagne! Sorry for the delay on getting this merged.
Co-authored-by: Jonathan Shimwell <[email protected]> Co-authored-by: Paul Romano <[email protected]>
Description
Adding an additional check to ensure r_grid, phi_grid, and theta_grid values make sense when creating a spherical mesh, and raise a Value Error when they do not. This way a Value Error will be raised when a user creates attempts to create a spherical mesh with a r_grid, phi_grid, or theta_grid minimum that is greater than or equal to the maximum.
Fixes # 2933
#2933
Checklist