Skip to content

Commit

Permalink
Merge pull request #395 from kbevers/better-test-data
Browse files Browse the repository at this point in the history
Better test data for gs48, gs50 and alsk
  • Loading branch information
kbevers committed Jun 14, 2016
2 parents 837e20d + 64a6bf2 commit 2dfe823
Showing 1 changed file with 79 additions and 78 deletions.
157 changes: 79 additions & 78 deletions src/PJ_mod_ster.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

PROJ_HEAD(mil_os, "Miller Oblated Stereographic") "\n\tAzi(mod)";
PROJ_HEAD(lee_os, "Lee Oblated Stereographic") "\n\tAzi(mod)";
PROJ_HEAD(gs48, "Mod. Stererographics of 48 U.S.") "\n\tAzi(mod)";
PROJ_HEAD(alsk, "Mod. Stererographics of Alaska") "\n\tAzi(mod)";
PROJ_HEAD(gs50, "Mod. Stererographics of 50 U.S.") "\n\tAzi(mod)";
PROJ_HEAD(gs48, "Mod. Stereographic of 48 U.S.") "\n\tAzi(mod)";
PROJ_HEAD(alsk, "Mod. Stereographic of Alaska") "\n\tAzi(mod)";
PROJ_HEAD(gs50, "Mod. Stereographic of 50 U.S.") "\n\tAzi(mod)";

#define EPSLN 1e-12

Expand Down Expand Up @@ -380,37 +380,38 @@ int pj_gs48_selftest (void) {return 0;}
#else

int pj_gs48_selftest (void) {
double tolerance_lp = 1e-10;
double tolerance_xy = 1e-7;
double tolerance_lp = 1e-12;
double tolerance_xy = 1e-8;

char s_args[] = {"+proj=gs48 +a=6400000 +lat_1=0.5 +lat_2=2"};
char s_args[] = {"+proj=gs48 +a=6370997"};

/* All latitudes and longitudes within the continental US */
LP fwd_in[] = {
{ 2, 1},
{ 2,-1},
{-2, 1},
{-2,-1}
{ -119.0, 40.0},
{ -70.0, 64.0},
{ -80.0, 25.0},
{ -95.0, 35.0}
};

XY s_fwd_expect[] = {
{36625944.1923860237, -10443454.370062707},
{32392147.7449533679, -12580705.358382076},
{31394918.3206626177, -3352580.92795714363},
{28553241.7702435851, -5673083.97367164213},
{-12110635.970867658000, 11668127.145744404000},
{ 55440975.381938063000, 52147696.705027729000},
{ 4451809.270766614000, 8613528.123849634100},
{ 468857.625827528540, 14336668.749030361000},
};

XY inv_in[] = {
{ 200, 100},
{ 200,-100},
{-200, 100},
{-200,-100}
{-11980000.0, 11570000.0},
{ 5500000.0, 52000000.0},
{ 4400000.0, 8600000.0},
{ 460000.0, 14000000.0},
};

LP s_inv_expect[] = {
{-95.997669975773789, -38.9990945807843801},
{-95.9976699161415326, -39.0009053728726585},
{-96.0023300242262252, -38.9990945807843801},
{-96.0023300838584817, -39.0009053728726585},
{-119.003821215898, 39.801671381755},
{ -92.805621432558, 59.836947814918},
{ -80.122548940303, 24.869675983950},
{ -94.990474496482, 34.401182359832},
};

return pj_generic_selftest (0, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, 0, s_fwd_expect, inv_in, 0, s_inv_expect);
Expand All @@ -426,52 +427,52 @@ int pj_alsk_selftest (void) {return 0;}
int pj_alsk_selftest (void) {

/* The standard test points are way outside the definition area bounds, hence we relax tolerances */
double tolerance_lp = 1e-7;
double tolerance_xy = 1e-4;
double tolerance_lp = 1e-12;
double tolerance_xy = 1e-8;

char e_args[] = {"+proj=alsk +ellps=GRS80 +lat_1=0.5 +lat_2=2"};
char s_args[] = {"+proj=alsk +a=6400000 +lat_1=0.5 +lat_2=2"};
char e_args[] = {"+proj=alsk +ellps=clrk66"};
char s_args[] = {"+proj=alsk +a=6370997"};

LP fwd_in[] = {
{ 2, 1},
{ 2,-1},
{-2, 1},
{-2,-1}
{-160.0, 55.0},
{-160.0, 70.0},
{-145.0, 70.0},
{-145.0, 60.0}
};

XY e_fwd_expect[] = {
{1642864080.02732754, -1139302009.02887797},
{1991193850.2052319, -1518851027.13339996},
{ 896601956.44416213, -1580143099.4169271},
{1018553822.30535674, -2028874099.61853552},
{-513253.146950842060, -968928.031867943470},
{-305001.133897637190, 687494.464958650530},
{266454.305088600490, 683423.477493030950},
{389141.322439243960, -423913.251230396680},
};

XY s_fwd_expect[] = {
{1651105846.06753755, -1132233885.29928017},
{2004822703.03845358, -1512578241.93150067},
{ 907039096.196665168, -1578565868.60405397},
{1033243931.08174837, -2030485879.68075895},
{-511510.319410844070, -967150.991676078060},
{-303744.771290368980, 685439.745941123230},
{265354.974019662940, 681386.892874573010},
{387711.995394026630, -422980.685505462640},
};

XY inv_in[] = {
{ 200, 100},
{ 200,-100},
{-200, 100},
{-200,-100}
{-500000.0, -950000.0},
{-305000.0, 700000.0},
{ 250000.0, 700000.0},
{ 400000.0, -400000.0}
};

LP e_inv_expect[] = {
{-151.99590140340095, 64.0008994430213534},
{-151.995901665843263, 63.9991004415502687},
{-152.004098597614217, 64.0008994436154524},
{-152.004098335171818, 63.9991004409561413},
{-159.830804302926, 55.183195262220},
{-160.042203155537, 70.111086864056},
{-145.381043551466, 70.163900908411},
{-144.758985461448, 60.202929200739},
};

LP s_inv_expect[] = {
{-151.995904192970613, 64.0008976554005926},
{-151.995904455051942, 63.9991022295943921},
{-152.004095808043218, 64.0008976559930716},
{-152.004095545961775, 63.9991022290018208},
{-159.854014457557, 55.165653849074},
{-160.082332371601, 70.128307617632},
{-145.347827407243, 70.181566919011},
{-144.734239827146, 60.193564732505},
};

return pj_generic_selftest (e_args, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, e_fwd_expect, s_fwd_expect, inv_in, e_inv_expect, s_inv_expect);
Expand All @@ -485,52 +486,52 @@ int pj_gs50_selftest (void) {return 0;}
#else

int pj_gs50_selftest (void) {
double tolerance_lp = 1e-10;
double tolerance_xy = 1e-7;
double tolerance_lp = 1e-12;
double tolerance_xy = 1e-8;

char e_args[] = {"+proj=gs50 +ellps=GRS80 +lat_1=0.5 +lat_2=2"};
char s_args[] = {"+proj=gs50 +a=6400000 +lat_1=0.5 +lat_2=2"};
char e_args[] = {"+proj=gs50 +ellps=clrk66"};
char s_args[] = {"+proj=gs50 +a=6370997"};

LP fwd_in[] = {
{ 2, 1},
{ 2,-1},
{-2, 1},
{-2,-1}
{-160.0, 65.0},
{-130.0, 45.0},
{ -65.0, 45.0},
{ -80.0, 36.0},
};

XY e_fwd_expect[] = {
{29729016747.3571701, -3918216218.3354063},
{36735969814.5893631, -14677374776.9809761},
{14161556831.8443203, -11410194658.0201168},
{14213883663.1140423, -19065362387.8745575},
{-1874628.5377402329, 2660907.942291015300},
{ -771831.51885333552, 48465.166491304852},
{ 4030931.8339815089, 1323687.864777399200},
{ 3450764.2615361013, -175619.041820732440},
};

XY s_fwd_expect[] = {
{30210185088.2270584, -3211636634.93554688},
{37664745793.3519745, -13981519124.6516781},
{14657726636.8231983, -11238369787.8965397},
{14923510723.7682972, -19062616309.6883698},
{-1867268.2534600089, 2656506.230401823300},
{ -769572.18967299373, 48324.312440863941},
{ 4019393.068680791200, 1320191.309350289200},
{ 3442685.615172345700, -178760.423489428680},
};

XY inv_in[] = {
{ 200, 100},
{ 200,-100},
{-200, 100},
{-200,-100}
{-1800000.0, 2600000.0},
{ -800000.0, 500000.0},
{ 4000000.0, 1300000.0},
{ 3900000.0, -170000.0},
};

LP e_inv_expect[] = {
{-119.997423271634844, 45.0009140704890811},
{-119.997423354194112, 44.9990858708950014},
{-120.00257673100937, 45.0009140729899428},
{-120.002576648448965, 44.9990858683939408},
{-157.989284999679, 64.851559609698},
{-131.171390466814, 49.084969745967},
{ -65.491568685301, 44.992837923774},
{ -75.550660091101, 34.191114075743},
};

LP s_inv_expect[] = {
{-119.997427429220934, 45.0009094967551704},
{-119.997427511518453, 44.9990904451617482},
{-120.002572573413815, 45.0009094992385954},
{-120.00257249111516, 44.9990904426780602},
{-158.163295044933, 64.854288364994},
{-131.206816959506, 49.082915350974},
{ -65.348945220767, 44.957292681774},
{ -75.446820242089, 34.185406225616},
};

return pj_generic_selftest (e_args, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, e_fwd_expect, s_fwd_expect, inv_in, e_inv_expect, s_inv_expect);
Expand Down

0 comments on commit 2dfe823

Please sign in to comment.