Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Why default tolerance at 0 in indexing on axis coordinate value? #205

Open
Chiil opened this issue Feb 5, 2022 · 1 comment
Open

Why default tolerance at 0 in indexing on axis coordinate value? #205

Chiil opened this issue Feb 5, 2022 · 1 comment

Comments

@Chiil
Copy link

Chiil commented Feb 5, 2022

I was playing around AxisArrays for the first time and did this:

using AxisArrays

x = 0:10:100 |> collect
a = AxisArray(rand(length(x)); x=x)

println(a[x=29..33])
println(a[x=30..30])
println(a[atvalue(29; atol=5)])
println(a[atvalue(29)]) # Does not work.

Would it not be more intuitive to set the default tolerance to a very large value? For my own personal use, I would use AxisArrays to find values nearest to a given coordinate in gridded data. Or did I overlook an option to set the default tolerance?

@gltchr
Copy link

gltchr commented Aug 20, 2024

I was trying out the package for a last couple of days and I feel very excited with the features it provides and thankful for the work of the developers.
I was a little startled when I have encountered the same problem as described by @Chiil : I was expecting that indexing with atvalue() should yield a nearest neighbor index to the provided value. However I was getting an inconsistent error when indexing into a time-axis: certain indices would work, but others would through a BoundsError. Setting tolerance manually has fixed the issue, but seems counterintuitive considering the general aim of the package.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants