-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add enhanced support for geographic coordinates #181
Conversation
💖 Thanks for opening this pull request! 💖 Please make sure you read our Contributing Guide and abide by our Code of Conduct. A few things to keep in mind:
|
@santisoler thanks for taking a shot at this! A few things to think about:
As a general rule, I find it useful to write the example for the feature first. That way I quickly see the usability problems and if I can't think of an example, then it probably isn't needed. It's always easier to make a private function public than the other way around. |
Thanks @leouieda for the review.
I think you're right, it should be private, at least for now.
Thanks for pointing this out. Writing test functions is tricky. First you think how the function should work, then spend time writing it and optimizing it. And then you have to switch your brain to what could go wrong with it. It's not easy work and we often need another pair of eyes.
That's a nice way to start to write a new function. I'll try to implement it in the future. |
Make latlon_continuity a private function intended to work only on inside() function (at least for now). Simplify its logic and solved big issues regarding overlapping regions.
@leouieda I've rewritten the I thought this enhancement would be straight forward, but each time I dive into it I find rough points. |
Now check_region raise errors if latitudes < -90 or > 90 and longitudes < -180 or > 360.
Make longitude_continuity a completely separated function from inside and change check functions for region and coordinates. Both inside and check_region functions were returned to its versions in master.
@leouieda I've made some of the proposed changes. longitude_continuity(coordinates=None, region=region) Please, take a look at it and let me know if I should change anything else or if I'm missing something. |
Yep, the functionality looks good and the function does what we want. The only thing I'm entirely sure about is the function returning 1 or 2 things depending on input. I think this might come back to haunt us later. I'm leaning towards always returning I think we talked about this but I can't remember: do we need Do you have a sample dataset in mind that we could use for this? I can look for data around longitude 0 somewhere if not. |
Co-Authored-By: Leonardo Uieda <leouieda@gmail.com>
Co-Authored-By: Leonardo Uieda <leouieda@gmail.com>
Co-Authored-By: Leonardo Uieda <leouieda@gmail.com>
I have the same doubt regarding the 1 or 2 outputs. I think we should return _, new_region = vd.longitude_continuity(None, region)
Yeah! The tesseroid implementation on Harmonica is a perfect example where you don't mind about the coordinates, you just want to adjust the boundaries of the tesseroid (remember that the computation point coordinates and tesseroid boundaries are merged inside the kernels, where the angles are always arguments of trigonometric functions, so we don't mind about phases).
Any dataset could be useful. For example, ETOPO1 is on the
Although I think finding a dataset defined on |
Hi @santisoler, left a few comments here with minor things. What do we need to get this merged? The API looks good to me and the functionally seems to all be there. The test coverage is missing a fit and there are some CI errors. We could try to move this forward soon to make a new Verde release. |
Co-Authored-By: Leonardo Uieda <leouieda@gmail.com>
@leouieda Now Let me know if something else should be done here, otherwise I think this PR it's ready to be merged! |
That is unrelated and a bit of a bad test now that I think about it. I don't know why it's complaining so much actually. Probably an update of numba that issues a new warning. I'll see if I can fix this in another PR before merging this. If not, then I'll merge as is. Thanks for implementing this! |
Add
latlon_continuity()
function that moves a set of longitudinal coordinates eitherto the
[0, 360)
or[-180, 180)
degrees intervals, depending which one is more suited forthat particular set of coordinates.
It also allow to modify an extra set of coordinates based on the decision made on the
first set.
Modify the
inside()
function to enhance how the inside points are selected, even iftheir longitudinal coordinates are not defined on the same degree interval.
Fixes #171
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
andverde/__init__.py
.