-
Notifications
You must be signed in to change notification settings - Fork 32
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
Point In Face #1056
base: main
Are you sure you want to change the base?
Point In Face #1056
Conversation
@ philipc2 do you think this should be an internal function or exposed to the user? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include an ASV benchmark. I'd suggest doing a parameterized benchmark for the 120 and 480 km MPAS grids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the optimized functions from #1072 and try to write the function entirely in Numba. This may require us to pass in both the cartesian and spherical versions of point & polygon. Let me know if you have any questions!
Half the faces don't pass, and the other half do. The first 3 at least fail, if I remember correctly. Interestingly, with your changes on a gca_gca intersection to make it cartesian only, it works better if the reference point is changed to be next to the pole but not the pole itself. However, there hasn't been any improvement when doing the same thing with the current implementation of the intersection code. So something seems to have changed from the changes you are making in that PR. |
uxarray/test/test_intersections.py Lines 95 to 114 in f783f61
I've added the test case here in #1112 The correct intersection is computed up to |
Thanks for this Philip. |
@hongyuchen1030 using your branch and the code from this branch, it works properly when the reference point is not on the pole, so whatever the issue seems to be fixed in that PR. Thanks for taking the time to look at this for me though! |
I think me and @philipc2 had resolved this through the recently merged branch #1112 , Thanks again for @philipc2's help. With the updated algorithm, it should work for the the pole point as well now. |
…/uxarray into zedwick/point-in-polygon
@philipc2 do you know why this is failing? It doesn't have any issues locally when I run the tests, but for some reason, it fails on the CI, saying that it can't resize the array. Could you checkout the branch and try running the test cases? Also, another odd problem is that half of the time the tests do fail locally, saying no faces were found in the subset, but the other half of the time faces are found. I am pretty confused by that as well. So any insight into that would be appreciated if you have any ideas. |
Can you point us to the specific testcase that's been failing?
Are you using the same setting? Did you clear the cache everytime you run it? |
The test cases that are failing are just the ones on the CI, which are listed under it if you click there, they are the two test cases I added for the point containing polygon grid function. Everything should be the same across environments, that I know of. That’s why I wanted to see if it passed or failed on someone else’s machine, to hopefully point me in some direction of what the error could be. |
Can you share your environment information? (Python Version & Installed packages) |
The tests are failing on my machine as well. |
I didn't see any |
uxarray/grid/grid.py
Outdated
face_edge_cartesian = _get_cartesian_face_edge_nodes( | ||
subset.face_node_connectivity.values, | ||
subset.n_face, | ||
subset.n_max_face_edges, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be the issue here.
If you pass in subset.n_max_face_nodes
it works correctly (both values are equivalent).
When the connectivity construction for self.face_edge_connectivity
, it leads to issues. I am looking deeper into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, okay. So something with constructing the face_edge causes issues. Thanks for the fix for now, let me know if you figure out the issue. From what I saw, it seems to have something to do with the inverse indices, it uses the wrong ones, the ones gotten from the subset, instead of the ones stored inside grid._ds["edge_node_connectivity"].attrs
. Maybe it is getting overwritten somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inverse indices in the context of edge_node_connectivity
are different than the inverse_indices
from the subset. I don't believe that they are overwritten, but something is definitely off.
Ah, I see what you mean, no, my local is failing at a different point. But on the same test cases. I will try and reset my environment to make sure it's up to date. |
Closes #905
Overview
Expected Usage
PR Checklist
General
Testing
Documentation
_
) and have been added todocs/internal_api/index.rst
docs/user_api/index.rst