Handle xarray DataArray in wrapped ufuncs#67
Conversation
ocefpaf
left a comment
There was a problem hiding this comment.
Do you want to add tests or should we merge this for now?
| ismasked = np.any([np.ma.isMaskedArray(a) for a in args]) | ||
| isarray = [hasattr(a, '__iter__') for a in args] | ||
| ismasked = [np.ma.isMaskedArray(a) for a in args] | ||
| isduck = [hasattr(a, '__array_ufunc__') |
There was a problem hiding this comment.
😄
Maybe isarrayinterface? No strong opinions, I actually like isduck ;-p
|
Playing around by hand, everything seemed to magically work as expected, dask array chunks, special xarray broadcasting, even return object types (eg xr.DataSet) and coordinate propagation for xarray things. Basically, this is amazing and I think it what is actually wanted with respect to dask/xarray support. That said, I've only just gotten started with the chunked/"bigish" data stuff myself, so I'd really want someone like @rabernat to take a look at this. |
|
@ocefpaf, let's hold off on merging for a couple days; I would like to add at least some minimal tests. |
Same here. All my "basic" tests worked. I guess we had almost everything we needed in the match_args already. Thanks @efiring! |
|
I think this is good enough to merge, so I will proceed. That should facilitate additional testing and recommendations for more work, if needed. |
|
@efiring are you OK if I issue a new release? 3.4.0? |
|
Sure, go ahead. Thank you. |
Closes #66 and #65, unless someone comes up with an example illustrating that there is more we need to do.
This is based on
__array_ufunc__; it's not clear whether anything .Tests include running all the check functions with minimal xarray DataArrays for SA_check_cast, t_check_cast, and p_check_cast. Additional tests include one based on the following example.