-
Notifications
You must be signed in to change notification settings - Fork 17
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 method for computing prime vertical radius #35
Conversation
@leouieda Please take a look at this when you have time. I decided it's effectively better to have this method. Because the method it's private, I took the liberty of setting the sine of the latitude angle as argument, so it can be efficiently used for coordinates conversions (in Boule) and for calculating geodetic distances (in Harmonica). |
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.
Thanks, @santisoler! Right, this is better than copying the calculation everywhere. I like the thought of just asking the user to do the sine calculation. We might as well make this a public method anyway. Left a few suggestions for the docstring.
Still needs some tests. One way to test this is to calculate on the pole and equator and check against semi-major and semi-minor axis. Another is to try to find pre-computed values at mid latitudes for WGS84 or the like and test against that.
Co-authored-by: Leonardo Uieda <[email protected]>
Co-authored-by: Leonardo Uieda <[email protected]>
Co-authored-by: Leonardo Uieda <[email protected]>
Co-authored-by: Leonardo Uieda <[email protected]>
Co-authored-by: Leonardo Uieda <[email protected]>
Co-authored-by: Leonardo Uieda <[email protected]>
👍
Yes, I agree. I even though about making it public after I opened the PR yesterday.
Yes, you're right about that. Even though the coordinate conversions tests are actually using it. we might want to add specific tests for this new method. If latitude is 90 or -90, then the cosine is 0, therefore the prime vertical radius will be equal to: That's why, when converting the coordinates to Cartesian and specially computing the z coordinate, the prime vertical radius is also multiplied by (1 - e^2): I'll add a test function to compare the prime vertical radius on the equator and the poles. |
Add test functions that checks the prime vertical radius on the equator and the poles.
@santisoler looks good to go! I fixed the issues with the Mac builds. Merging and releasing 0.2.0 |
Add private method to
boule.Ellipsoid
for computing the prime vertical radius.The definition of the prime vertical radius can be seen on Vermeille (2002) and Vajda (2004).
It's usually symbolized with the letter N and depends on the geometry of the ellipsoid and it must be evaluated on a certain latitude angle.
We were already computing it for applying the geodetic to geodetic to spherical coordinate conversion.
It is also needed for computing the Euclidean distance between two points given in geodetic coordinates (see Vajda, 2004), feature that will be added after solving fatiando/harmonica#154 .
In order to prevent rewriting the equation, it's better to have a private function inside
boule.Ellipsoid
.The new method takes the precomputed sine of the latitude angle to make it more efficient.
Reminders:
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
and the base__init__.py
file for the package.AUTHORS.md
file (if you haven't already) in case you'd like to be listed as an author on the Zenodo archive of the next release.