Skip to content
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

Implemented IGH Oceanic View #2226

Merged
merged 24 commits into from May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a6b972e
Implemented IGH Oceanic View
jkrasting May 15, 2020
d782832
Fixed table formatting error in igh_o.rst
jkrasting May 15, 2020
b46179a
Added test and image for igh_o projection
jkrasting May 15, 2020
f661d28
Updated igh_o testing values
jkrasting May 15, 2020
9f1d467
Added docstrings igh_o.cpp
jkrasting May 15, 2020
1aaa388
Edits to igh_o test values
jkrasting May 15, 2020
73f5d6f
Updated sign error on some igh_o test values
jkrasting May 15, 2020
4f1fced
Referenced igh_o rst doc file in index
jkrasting May 15, 2020
d34748b
Replaced d4044118 with phi_boundary
jkrasting May 15, 2020
bc96737
Changed int=0 to bool type
jkrasting May 15, 2020
cf4f889
Extended doc updates to igh.cpp
jkrasting May 15, 2020
28acad1
Replaced SETUP macro with setup_zone func
jkrasting May 15, 2020
c32875b
Removed trailing backslashes from setup_zone
jkrasting May 15, 2020
87761d4
Simplified 'struct pj_opaque *Q' call in igh*.cpp
jkrasting May 15, 2020
68e164a
Updated sub-projection boundaries for igh_o
jkrasting May 16, 2020
59813f1
Updated testing values for igh_o
jkrasting May 16, 2020
d2b5171
Fixed typo in plotdefs.json
jkrasting May 16, 2020
b785d2c
Sub-projection tests for igh and igh_o
jkrasting May 18, 2020
640d260
Update test/gie/builtins.gie
jkrasting May 17, 2020
5abdf10
Added roundtrip for igh_o subprojection tests
jkrasting May 18, 2020
93bee75
Updated if tests for bool vs int variables
jkrasting May 18, 2020
bf6a8dc
Changed boundary from zone 3 to zone 4 in igh_o
jkrasting May 18, 2020
a7105e3
Revert "Updated if tests for bool vs int variables"
jkrasting May 18, 2020
4dc21af
Fixed typo in igh_o zone definitions
jkrasting May 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 28 additions & 19 deletions src/projections/igh.cpp
Expand Up @@ -186,14 +186,17 @@ static PJ *destructor (PJ *P, int errlev) {
-180 -100 -20 80 180
*/

#define SETUP(n, proj, x_0, y_0, lon_0) \
if (!(Q->pj[n-1] = pj_##proj(nullptr))) return destructor(P, ENOMEM); \
if (!(Q->pj[n-1] = pj_##proj(Q->pj[n-1]))) return destructor(P, ENOMEM); \
Q->pj[n-1]->ctx = P->ctx; \
Q->pj[n-1]->x0 = x_0; \
Q->pj[n-1]->y0 = y_0; \
static bool setup_zone(PJ *P, struct pj_opaque *Q, int n, \
rouault marked this conversation as resolved.
Show resolved Hide resolved
PJ*(*proj_ptr)(PJ*), double x_0, \
double y_0, double lon_0) {
if (!(Q->pj[n-1] = proj_ptr(nullptr))) return false;
if (!(Q->pj[n-1] = proj_ptr(Q->pj[n-1]))) return false;
Q->pj[n-1]->ctx = P->ctx;
Q->pj[n-1]->x0 = x_0;
Q->pj[n-1]->y0 = y_0;
Q->pj[n-1]->lam0 = lon_0;

return true;
}

PJ *PROJECTION(igh) {
PJ_XY xy1, xy3;
Expand All @@ -205,15 +208,18 @@ PJ *PROJECTION(igh) {


/* sinusoidal zones */
SETUP(3, sinu, -d100, 0, -d100);
SETUP(4, sinu, d30, 0, d30);
SETUP(5, sinu, -d160, 0, -d160);
SETUP(6, sinu, -d60, 0, -d60);
SETUP(7, sinu, d20, 0, d20);
SETUP(8, sinu, d140, 0, d140);
if (!setup_zone(P, Q, 3, pj_sinu, -d100, 0, -d100) ||
!setup_zone(P, Q, 4, pj_sinu, d30, 0, d30) ||
!setup_zone(P, Q, 5, pj_sinu, -d160, 0, -d160) ||
!setup_zone(P, Q, 6, pj_sinu, -d60, 0, -d60) ||
!setup_zone(P, Q, 7, pj_sinu, d20, 0, d20) ||
!setup_zone(P, Q, 8, pj_sinu, d140, 0, d140))
{
return destructor(P, ENOMEM);
}

/* mollweide zones */
SETUP(1, moll, -d100, 0, -d100);
setup_zone(P, Q, 1, pj_moll, -d100, 0, -d100);

/* y0 ? */
xy1 = Q->pj[0]->fwd(lp, Q->pj[0]); /* zone 1 */
Expand All @@ -224,11 +230,14 @@ PJ *PROJECTION(igh) {
Q->pj[0]->y0 = Q->dy0;

/* mollweide zones (cont'd) */
SETUP( 2, moll, d30, Q->dy0, d30);
SETUP( 9, moll, -d160, -Q->dy0, -d160);
SETUP(10, moll, -d60, -Q->dy0, -d60);
SETUP(11, moll, d20, -Q->dy0, d20);
SETUP(12, moll, d140, -Q->dy0, d140);
if (!setup_zone(P, Q, 2, pj_moll, d30, Q->dy0, d30) ||
!setup_zone(P, Q, 9, pj_moll, -d160, -Q->dy0, -d160) ||
!setup_zone(P, Q,10, pj_moll, -d60, -Q->dy0, -d60) ||
!setup_zone(P, Q,11, pj_moll, d20, -Q->dy0, d20) ||
!setup_zone(P, Q,12, pj_moll, d140, -Q->dy0, d140))
{
return destructor(P, ENOMEM);
}

P->inv = igh_s_inverse;
P->fwd = igh_s_forward;
Expand Down
48 changes: 29 additions & 19 deletions src/projections/igh_o.cpp
Expand Up @@ -201,14 +201,17 @@ static PJ *destructor (PJ *P, int errlev) {
-180 -75 90 180
*/

#define SETUP(n, proj, x_0, y_0, lon_0) \
if (!(Q->pj[n-1] = pj_##proj(nullptr))) return destructor(P, ENOMEM); \
if (!(Q->pj[n-1] = pj_##proj(Q->pj[n-1]))) return destructor(P, ENOMEM); \
Q->pj[n-1]->ctx = P->ctx; \
Q->pj[n-1]->x0 = x_0; \
Q->pj[n-1]->y0 = y_0; \
static bool setup_zone(PJ *P, struct pj_opaque *Q, int n, \
PJ*(*proj_ptr)(PJ*), double x_0, \
double y_0, double lon_0) {
if (!(Q->pj[n-1] = proj_ptr(nullptr))) return false;
if (!(Q->pj[n-1] = proj_ptr(Q->pj[n-1]))) return false;
Q->pj[n-1]->ctx = P->ctx;
Q->pj[n-1]->x0 = x_0;
Q->pj[n-1]->y0 = y_0;
Q->pj[n-1]->lam0 = lon_0;

return true;
}

PJ *PROJECTION(igh_o) {
PJ_XY xy1, xy3;
Expand All @@ -220,15 +223,19 @@ PJ *PROJECTION(igh_o) {


/* sinusoidal zones */
SETUP(4, sinu, -d150, 0, -d150);
SETUP(5, sinu, -d40, 0, -d40);
SETUP(6, sinu, d120, 0, d120);
SETUP(7, sinu, -d120, 0, -d120);
SETUP(8, sinu, d10, 0, d10);
SETUP(9, sinu, d130, 0, d130);
if (!setup_zone(P, Q, 4, pj_sinu, -d150, 0, -d150) ||
!setup_zone(P, Q, 5, pj_sinu, -d40, 0, -d40) ||
!setup_zone(P, Q, 6, pj_sinu, d120, 0, d120) ||
!setup_zone(P, Q, 7, pj_sinu, -d120, 0, -d120) ||
!setup_zone(P, Q, 8, pj_sinu, d10, 0, d10) ||
!setup_zone(P, Q, 9, pj_sinu, d130, 0, d130))
{
return destructor(P, ENOMEM);
}


/* mollweide zones */
SETUP(1, moll, -d150, 0, -d150);
setup_zone(P, Q, 1, pj_moll, -d150, 0, -d150);

/* y0 ? */
xy1 = Q->pj[0]->fwd(lp, Q->pj[0]); /* zone 1 */
Expand All @@ -239,11 +246,14 @@ PJ *PROJECTION(igh_o) {
Q->pj[0]->y0 = Q->dy0;

/* mollweide zones (cont'd) */
SETUP( 2, moll, -d40, Q->dy0, -d40);
SETUP( 3, moll, d120, Q->dy0, d120);
SETUP(10, moll, -d120, -Q->dy0, -d120);
SETUP(11, moll, d10, -Q->dy0, d10);
SETUP(12, moll, d130, -Q->dy0, d130);
if (!setup_zone(P, Q, 2, pj_moll, -d40, Q->dy0, -d40) ||
!setup_zone(P, Q, 3, pj_moll, d120, Q->dy0, d120) ||
!setup_zone(P, Q, 10, pj_moll, -d120, -Q->dy0, -d120) ||
!setup_zone(P, Q, 11, pj_moll, d10, -Q->dy0, d10) ||
!setup_zone(P, Q, 12, pj_moll, d130, -Q->dy0, d130))
{
return destructor(P, ENOMEM);
}

P->inv = igh_o_s_inverse;
P->fwd = igh_o_s_forward;
Expand Down