holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.26k stars 363 forks source link

Separate out 3d and 4d combine functions #1243

Closed ianthomas23 closed 1 year ago

ianthomas23 commented 1 year ago

For *_n reductions such as max_n we need 3d and 4d versions of combine functions to support non-categorical aggregations with shape (ny, nx, n) and categorical aggregations with shape (ny, nx, ncat, n). In the main branch we currently only implement the 4d versions and when we are dealing with non-categorical 3d arrays we insert an extra dimension so that they can be considered to have a single category. This has been fine up until now.

Looking forward I am implementing antialiased line support for inspection reductions such as max_n and where and these combine functions are needed in the antialiased line code. This requires the array dimension changing to occur within numba-jitted functions which isn't really viable as numpy arrays with different dimensions are considered different types in numba. So here the solution is to have separate 3d and 4d numba-jitted functions which iterate over the arrays and call common functions to do the low-level maths.

codecov[bot] commented 1 year ago

Codecov Report

Merging #1243 (049e036) into main (6e9b412) will increase coverage by 0.06%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1243      +/-   ##
==========================================
+ Coverage   83.36%   83.42%   +0.06%     
==========================================
  Files          35       35              
  Lines        8826     8858      +32     
==========================================
+ Hits         7358     7390      +32     
  Misses       1468     1468              
Impacted Files Coverage Δ
datashader/reductions.py 77.87% <100.00%> (ø)
datashader/utils.py 83.80% <100.00%> (+1.31%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more