DimensionalData.jl icon indicating copy to clipboard operation
DimensionalData.jl copied to clipboard

new, explicit-like, lookup for explicit but continuous bounds

Open asinghvi17 opened this issue 7 months ago • 5 comments

Think of the bounds of a histogram which can be represented by LinRange(minval, maxval, n_bins+1). There's no good way to do this in DD at the moment that is not Explicit, which loses the idea that you don't need to duplicate the lookup values. Specifically, the "bounds" of the interval at index i are given by (range[i], range[i+1]). This is a pretty standard strategy (perhaps the most standard) and has the advantage of allowing a natural way to reproject intervals lookups - as this kind of explicit lookup where we still know it's continuous.

Spherical cellarea is still too slow for my tastes so I want to optimize it by chunking where possible. Would some

asinghvi17 avatar Apr 20 '25 23:04 asinghvi17

fyi, this is for https://github.com/rafaqz/Rasters.jl/issues/945 - I am doing some sketchy stuff there which would be made way easier if we had this!

asinghvi17 avatar Apr 21 '25 03:04 asinghvi17

Have you tried intervalbounds ?

(we should probably document it and internalise most of the methods...)

But you can do intervalbounds(lookup::Lookup, i::Int) for each interval to be returned as a Tuple

rafaqz avatar Apr 21 '25 12:04 rafaqz

I ended up using that! But it still feels pretty ugly.

asinghvi17 avatar Apr 21 '25 12:04 asinghvi17

Why is it ugly?

rafaqz avatar Apr 21 '25 13:04 rafaqz

It's generic over all span types. What youre talking about will only apply to Regular lookups that are actually ranges

rafaqz avatar Apr 21 '25 13:04 rafaqz