Closed ianthomas23 closed 1 year ago
Merging #1184 (b6ed7a5) into main (229cea3) will increase coverage by
0.09%
. The diff coverage is89.83%
.
@@ Coverage Diff @@
## main #1184 +/- ##
==========================================
+ Coverage 85.39% 85.48% +0.09%
==========================================
Files 35 35
Lines 8023 8232 +209
==========================================
+ Hits 6851 7037 +186
- Misses 1172 1195 +23
Impacted Files | Coverage Δ | |
---|---|---|
datashader/glyphs/line.py | 92.84% <ø> (-0.12%) |
:arrow_down: |
datashader/reductions.py | 86.17% <86.97%> (+0.17%) |
:arrow_up: |
datashader/compiler.py | 95.74% <100.00%> (+0.12%) |
:arrow_up: |
datashader/core.py | 88.38% <100.00%> (+0.02%) |
:arrow_up: |
datashader/utils.py | 79.25% <100.00%> (+2.40%) |
:arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
After discussion, we've decided to allow multiple *_n
reductions only if they all have the same n
value. This allows us to keep the new coordinate label as n
.
This is further work on improved inspection reductions (issue #1126) to add
first_n
,last_n
,max_n
andmin_n
reductions. Each accepts a column name and value forn
, the number of results to return for each pixel. For example,max("value", n=3)
will return a DataArray of shape(ny, nx, n)
containing the 3 highest values of column"value"
for each pixel.Demo code using these within a
where
reduction to return corresponding row indexes or values from a different column:which outputs
where, as usual,
-1
means no row index andnan
means no data to return.This allows us to do some complicated combinations such as
to return
count
plusmin_n
andmax_n
(orfirst_n
andlast_n
) in a single datashader pass.max_n
andmin_n
work with dask but not CUDA (issue #1177 needs to be solved for that).first_n
andlast_n
only work on the CPU and without dask, the same asfirst
andlast
(#1177 and #1182 are needed to fix that).Using antialiased lines the results looked OK in some situation and not others, so I am raising a
NotImplemented
error for all of these when using with antialiasing and I will separately consider what is reasonable behaviour here. This includeswhere(first_n)
and so on as well.There is one issue here that needs deciding. I've called the third dimension of the DataArray returned by such a reduction
"n"
to fit in with the namesfirst_n
, etc. You can put multiplewhatever_n
reductions in a singlesummary
reduction as shown above. If they have the samen
then it all works out as expected. But we need a policy on labelling the third dimension if thewhatever_n
have differentn
values. We could keep the firstn
asn
, and if subsequentn
values are different call themn1
,n2
, etc?