Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Getting row, col in input data array coorespointing to selection (nearest point) #42

Open
axelschweiger opened this issue Feb 14, 2023 · 2 comments

Comments

@axelschweiger
Copy link

Just found xoak which sounds like great tool. This so maybe silly question, but I am wondering if there is a way of not only returning the closest data value in the input array (let's say it is two dimensional), but also the row and column corresponding to the selected point(s). in my application, I'd like to change the value of that point so I need someway to access it.

Thanks
Axel

@benbovy
Copy link
Member

benbovy commented May 26, 2023

Hi @axelschweiger (sorry for the long wait!),

I'm thinking about two ways where you can get the array position indices:

  • When doing ds_out = ds_in.xoal.sel(...), the coordinates in ds_out are aligned with the corresponding coordinates in ds_in so I guess you could use that to retrieve the indices
  • Use directly the API of the underlying index objects (scipy, scikit-learn, s2index)

It would be useful to have a convenient way to do that, although I'm not sure how look like the API. Perhaps a simple use-case example would help?

@axelschweiger
Copy link
Author

axelschweiger commented May 26, 2023 via email

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

No branches or pull requests

2 participants