-
Notifications
You must be signed in to change notification settings - Fork 34
Add "where" based ufunc masked array support decorator #98
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
base: main
Are you sure you want to change the base?
Conversation
This certainly looks more elegant than what I originally came up with. I'm entirely open |
I think it makes sense to release both GSW-C and GSW-Python now. |
I agree, don't wait on this PR. |
Done and done! |
I am interested in continuing work on this, but would appreciate some guidance. This decorator does not work with the non ufunc functions we have. Reading through my code comments, I think I should at least make it clear that the |
257befb
to
03c29b0
Compare
I'm inclined to merge this. Are there any dangers? Is there any real problem with the need to keep the old decorator for the non-ufuncs, at least initially? |
A danger I can think of is the function signature change with the This would allow any of the ufunc optional keyword arguments to be passed through, so in some ways, might be a bit nicer/cleaner wrapping of the ufuncs. I don't see any places where masked array support is tested at all. Maybe there could be a parallel set of ufunc tests that have random (fixed seed?) masks applied and then checking that the output has the expected ORed together mask? My updates yesterday were just trying to get it rebased so it was in a merge-able state, since I was in the code anyway. Due to changes in the wrapped ufunc generators, was more tricky than I thought it would be. |
Regarding explicit masked array testing: I don't think we need to put in random masked points. Most of the testing is done with the test data and results from the Matlab version, which already has some NaNs. It should be sufficient to use "masked_invalid" to generate masked array inputs, which should then yield the same results as the original after converting the results back with "ma.filled()". |
This PR replaces the match_args_return decorator in _wrapped_ufuncs with the one proposed/discussed in #97 (comment) .
I don't think it's ready for merging: needs tests, more discussion, and the non ufunc functions need to be considered. But I wanted to show what a change like this might look like.