You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening this issue to track an issue with the initial implementation of unyt-dask arrays (which is approaching complete, #185).
The problem is that the unyt_dask_array class has no way of catching dask.array reductions. Operations like dask.array.min() get routed through dask.array.reductions.min() and will return plain arrays or float/int values.
When these operations exist as attributes, they can be called and will return unyt objects. i.e., :
importdask; importunytx_da=unyt_from_dask(dask.array.ones((10, 10), chunks=(2, 2)), unyt.m)
dask.array.min(x_da).compute() # returns a plain floatx_da.min().compute() # returns a unyt quantity
but when the functions do not exist as attributes, like dask.array.nanmin(), it is difficult to handle without manually wrapping all of those reductions functions and exposing them from within unyt (i.e., we would need to have a unyt.dask_array.nanmin() and similar for every operation).
To address this, #185 added a helper function, reduce_with_units. It is a simple helper function for calling a general dask.array reduction method on a unyt_dask_array to correctly handle units. It handles most cases, but it may be worth investigating other approaches.
The text was updated successfully, but these errors were encountered:
Opening this issue to track an issue with the initial implementation of unyt-dask arrays (which is approaching complete, #185).
The problem is that the
unyt_dask_array
class has no way of catchingdask.array
reductions. Operations likedask.array.min()
get routed throughdask.array.reductions.min()
and will return plain arrays or float/int values.When these operations exist as attributes, they can be called and will return unyt objects. i.e., :
but when the functions do not exist as attributes, like
dask.array.nanmin()
, it is difficult to handle without manually wrapping all of those reductions functions and exposing them from withinunyt
(i.e., we would need to have aunyt.dask_array.nanmin()
and similar for every operation).To address this, #185 added a helper function,
reduce_with_units
. It is a simple helper function for calling a generaldask.array
reduction method on aunyt_dask_array
to correctly handle units. It handles most cases, but it may be worth investigating other approaches.The text was updated successfully, but these errors were encountered: