Repository navigation
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 <drshimwell@gmail.com>
|
Thanks for those changes, I've triggered the CI |
|
CI has passed |
paulromano
left a comment
There was a problem hiding this comment.
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! |
paulromano
left a comment
There was a problem hiding this comment.
Thanks for this improvement, @chrwagne! Sorry for the delay on getting this merged.
Co-authored-by: Jonathan Shimwell <drshimwell@gmail.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
Co-authored-by: Jonathan Shimwell <drshimwell@gmail.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
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