-
Notifications
You must be signed in to change notification settings - Fork 7
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
searching for neighbours in the nth-ring around the center cell #13
Comments
@keewis, thank you for having open an issue. |
@keewis, done, but be aware of "strange" behaviors near base cell corners having only 2 base cell neighbours (instead of 3). Yes:
|
Thanks, that was much quicker than I had hoped! What's the difference between
Yes, my own implementation ( |
Having a look at: n_neighbours = (2 * ring + 1) ** 2 I understand that you expect all cells inside a square area of half size The You may also have a look at the MOC libraries: the rust one and the MOCPy python wrapper, see a visual example in the MOCPy doc here. The current test to know if a cell intersects a Cone (or a Ring) is based on a quick approximation leading to false positives. I still have to port in Rust the exact cell/cone intersection code I developed in Java. |
No, I only need the one that returns every cell contained by the (discrete) ring around the center (so maybe it should have been called |
Ok. I may call such a method |
I've been returning ring by ring from the innermost (0th) to the outermost (kth) ring as a flattened list (the order within the ring is not important), but for my particular use case I only require the center cell to be first. What do you return if there's only 7 neighbours for a corner cell? |
The neighbours method returns a MainWindMap which has several methods such as get(MainWind) or entries (I may also have implemented If you do not need the specific value for a given |
It would probably be simpler to still (have the option to) return |
Layer.neighbours
currently allows searching for the immediate neighbours of a cell. However, I need to be able to query the n-th ring of neighbours around that cell (the aim is to create a space-domain convolution algorithm based on sparse matrices).As far as I can tell, this should be possible by going integer offsets from the
(face, x, y)
(I think the code incdshealpix
calls thisd0h
,i
, andj
?) representation of the input cell:assuming that
account_for_face_boundary
is a function that recalculatesf
,x
, andy
if any ofx
ory
is outside the range of[0, nside[
... this is similar to what happens inedge_cell_neighbours
.So I was wondering whether you'd be open to adding a function that allows searching for neighbours within a
k
-ring around the center cell (somewhat likeh3ronpy
'sgrid_disk
)?(As a warning, I'm working in the geo-sciences, and will probably open a couple more requests like this. If you think any of these are out-of-scope for this project I'd be fine with moving those to a separate, geo-specific crate, but would then need access to lower-level functions like
decode
orbits_2_hash
)The text was updated successfully, but these errors were encountered: