-
Notifications
You must be signed in to change notification settings - Fork 761
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
Adding ellipsoidal equations for the Equal Earth #1101
Conversation
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 code seems fine to be, apart from my inlined comments.
The docs needs updating to reflect that the projection also exist in an ellipsoidal form.
src/PJ_eqearth.c
Outdated
#include <math.h> | ||
|
||
#include "projects.h" | ||
|
||
PROJ_HEAD(eqearth, "Equal Earth") "\n\tPCyl., Sph."; | ||
PROJ_HEAD(eqearth, "Equal Earth") "\n\tPCyl., Sph&Ell\n\th="; |
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.
What's up with the \n\th=
at the end here? As far as I can tell there's no +h
parameter present in this projection. Bad cut & paste job?
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.
Yes, bad cut & paste.
sbeta = pj_qsfn(sin(lp.phi), P->e, 1.0 - P->es) / Q->qp; | ||
if (fabs(sbeta) > 1) { | ||
/* Rounding error. */ | ||
sbeta = sbeta > 0 ? 1 : -1; |
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.
It would be nice to have a test case that exercises this condition.
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.
I am not sure I can hit this test case. The best testing case is probably phi = +/-90. In this case pj_qsfn() function returns +/-Q->qp and for some rounding error it might hit this case. Those tests are already in and looked they are passing.
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.
Using phi > 90 would not help, because sin function would already "fix" this.
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.
All right, we'll live without a test for that
We also need |
@kbevers: I added |
Indeed it was. Thanks! |
I just did. You shouldn't be able to do it. Thanks for adding this. |
Thanks! |
double sbeta; | ||
double psi, psi2, psi6; | ||
|
||
if (P->es != 0.0) { |
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.
A little bit of nitpicking here: For clarity, I would prefer to have block-scoped comments precede the block they refer to:
/* Ellipsoidal case, converting to authalic latitude */
if (P->es != 0.0) {
sbeta = pj_qsfn(sin(lp.phi), P->e, 1.0 - P->es) / Q->qp;
/* Rounding error. */
if (fabs(sbeta) > 1)
sbeta = sbeta > 0 ? 1 : -1;
}
/* Spheroidal case, using latitude */
else
sbeta = sin(lp.phi);
Or with even less branching:
sbeta = sin(lp.phi);
/* In the ellipsoidal case, we convert sbeta to authalic latitude */
if (P->es != 0.0) {
sbeta = pj_qsfn(sbeta, P->e, 1.0 - P->es) / Q->qp;
/* Rounding error. */
if (fabs(sbeta) > 1)
sbeta = sbeta > 0 ? 1 : -1;
}
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.
Sorry Thomas, I merged this while you were writing...
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.
Don't worry - although I think my suggestion has some merit in terms of clarity, it also is mostly cosmetical and may be simply a matter of personal preference
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.
I happy to do the change and another PR if you would like to...
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.
@beuan: Well - I wrote the comment because I would prefer to minimize branching and have block-scope comments precede the block.
But it's your code, and it's already merged, so please only make the change if you personally find my (cosmetical) arguments highly convincing, and would like to see the change - in which case I will obviously feel honoured, that you found the comment convincing and/or useful :-)
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.
@busstoptaktik No problem. Any additional inputs are welcome.
I have changes on the way. I just need to figure out how to make a pull request without any "merge conflicts"
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 changes is for #1097.