Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust
extrema
's internal structured type handling (#77)
* Covert `extrema`'s component types to `dtype`s Make sure that each component type in `extrema`'s structured `dtype` is converted to a `dtype`. * Use a 1-D singleton array in `extrema`'s kernel Instead of using a 0-D array in `extrema`'s kernel function, use a 1-D singleton array. As we have generally had better luck working with 1-D singleton structured arrays with Dask, it makes sense to use these consistently internally as well. Also avoids some hacky tricks to extract the value from the array in favor of just selecting the value. * Make `extrema`'s default with 1-D singleton array Instead of using a 0-D array to construct `extrema`'s default value, use a 1-D singleton array. As we have generally had better luck working with 1-D singleton structured arrays with Dask, it makes sense to use these consistently internally as well. Also avoids some hacky tricks to extract the value from the array in favor of just selecting the value. * Reorder `extrema`'s internal structured `dtype` Adjust the order of the `extrema`'s internal structured `dtype` to match the order of the result returned. * Make a mapping of `extrema`'s structured `dtype` Define a mapping using an `OrderedDict` of the names and types within the structured `dtype`. Use this to build the structured `dtype`. Also use this to breakout the specific results after running `extrema`'s kernel with `labeled_comprehension`. * Bind `dtype` in `extrema` kernel function Instead of reconstructing the `dtype` in `extrema`'s kernel function, bind this in advance using `functools.partial` so that it can be passed through to the `extrema` kernel function unchanged. Thus avoiding the need to define this in two different places and potentially getting them messed up.
- Loading branch information