@@ -2,59 +2,51 @@ use strict;
2
2
use warnings;
3
3
use PDL::LiteF;
4
4
use Test::More;
5
+ use Test::PDL;
5
6
use PDL::Transform::Proj4;
6
7
use PDL::Transform::Cartography;
7
8
8
- sub pdl_cmp {
9
- my ($g , $e , $l , $eps ) = @_ ;
10
- $_ = PDL-> topdl($_ ) for $g , $e ;
11
- local $Test::Builder::Level = $Test::Builder::Level + 1;
12
- my $res = all(approx($g , $e , $eps ));
13
- fail(" $l : result was BAD value" ), return if $res -> isbad;
14
- ok $res , $l or diag " got:\n $g \n expected:\n $e " ;
15
- }
16
-
17
9
my $fwd = pdl ' -146.25 -81.5625; -137.8125 -81.5625; -146.25 -73.125; -137.8125 -73.125' ;
18
10
my $inv = pdl ' 0 -7213503; 4809002 -7213503; 0 -4809002; 4809002 -4809002' ;
19
11
my $t = t_proj( proj_params => " +proj=eqc +lon_0=0 +datum=WGS84" );
20
- pdl_cmp $fwd -> apply($t ), pdl(<<'EOF' ), ' eqc fwd' , 10 ;
12
+ is_pdl $fwd -> apply($t ), pdl(<<'EOF' ), { test_name => ' eqc fwd' , atol => 10} ;
21
13
-16280476 -9079496; -15341217 -9079496;
22
14
-16280476 -8140237.8; -15341217 -8140237.8
23
15
EOF
24
- pdl_cmp $inv -> apply(!$t ), pdl(<<'EOF' ), ' eqc inv' , 1e-2;
16
+ is_pdl $inv -> apply(!$t ), pdl(<<'EOF' ), { test_name => ' eqc inv' , atol => 1e-2} ;
25
17
0 -64.8; 43.2 -64.8; 0 -43.2; 43.2 -43.2
26
18
EOF
27
19
28
20
$fwd = pdl ' -146.25 81.5625; -137.8125 81.5625; -146.25 73.125; -137.8125 73.125' ;
29
21
$inv = pdl ' 0 -4558236.1; 1530752.9 -4558236.1; 0 -3031095.5; 1530752.9 -3031095.5' ;
30
22
$t = t_proj( proj_params => " +proj=ortho +ellps=WGS84 +lon_0=-90 +lat_0=40" );
31
- pdl_cmp $fwd -> apply($t ), pdl(<<'EOF' ), ' ortho fwd' , 10 ;
23
+ is_pdl $fwd -> apply($t ), pdl(<<'EOF' ), { test_name => ' ortho fwd' , atol => 10} ;
32
24
-780706.14 4502242.5; -695714.05 4432238.3;
33
25
-1544186 4016381.2; -1376077.2 3877917.4
34
26
EOF
35
- pdl_cmp $inv -> apply(!$t ), pdl(<<'EOF' ), ' ortho inv' , 1e-2;
27
+ is_pdl $inv -> apply(!$t ), pdl(<<'EOF' ), { test_name => ' ortho inv' , atol => 1e-2} ;
36
28
-90 -5.9283617; -75.991258 -7.5230948; -90 11.481088; -75.886486 10.220222
37
29
EOF
38
30
39
31
$fwd = pdl ' -146.25 81.5625; -137.8125 81.5625; -146.25 73.125; -137.8125 73.125' ;
40
32
$inv = pdl ' 0 -4558236.1; 1530752.9 -4558236.1; 0 -3031095.5; 1530752.9 -3031095.5' ;
41
33
$t = t_proj_ortho( ellps => ' WGS84' , lon_0 => -90, lat_0 => 40 );
42
- pdl_cmp $fwd -> apply($t ), pdl(<<'EOF' ), ' ortho2 fwd' , 10 ;
34
+ is_pdl $fwd -> apply($t ), pdl(<<'EOF' ), { test_name => ' ortho2 fwd' , atol => 10} ;
43
35
-780706.14 4502242.5; -695714.05 4432238.3;
44
36
-1544186 4016381.2; -1376077.2 3877917.4
45
37
EOF
46
- pdl_cmp $inv -> apply(!$t ), pdl(<<'EOF' ), ' ortho2 inv' , 1e-2;
38
+ is_pdl $inv -> apply(!$t ), pdl(<<'EOF' ), { test_name => ' ortho2 inv' , atol => 1e-2} ;
47
39
-90 -5.9283617; -75.991258 -7.5230948; -90 11.481088; -75.886486 10.220222
48
40
EOF
49
41
50
42
$fwd = pdl ' -146.25 -81.5625; -137.8125 -81.5625; -146.25 -73.125; -137.8125 -73.125' ;
51
43
$inv = pdl ' 0 -6210111.4; 4081400 -6210111.4; 0 -4140074.2; 4081400 -4140074.2' ;
52
44
$t = t_proj_robin( ellps => ' WGS84' , over => 1 );
53
- pdl_cmp $fwd -> apply($t ), pdl(<<'EOF' ), ' robin fwd' , 10 ;
45
+ is_pdl $fwd -> apply($t ), pdl(<<'EOF' ), { test_name => ' robin fwd' , atol => 10} ;
54
46
-8363042.7 -8211603.9; -7880559.4 -8211603.9;
55
47
-9548357.3 -7548659.1; -8997490.5 -7548659.1
56
48
EOF
57
- pdl_cmp $inv -> apply(!$t ), pdl(<<'EOF' ), ' robin inv' , 1e-2;
49
+ is_pdl $inv -> apply(!$t ), pdl(<<'EOF' ), { test_name => ' robin inv' , atol => 1e-2} ;
58
50
0 -58.719767; 53.453033 -58.719767; 0 -38.71881; 46.580505 -38.71881
59
51
EOF
60
52
0 commit comments