1
+ # -*- coding: utf-8 -*-
2
+
3
+ import pytest
4
+ import os , sys
5
+ from collections import namedtuple
6
+ from pyosp import *
7
+
8
+ sys .path .append (os .path .dirname (os .path .abspath (__file__ )))
9
+ dat = os .path .join (os .path .dirname (os .path .abspath (__file__ )), "../datasets/" )
10
+
11
+ homo_line = os .path .join (dat , 'homo_baseline.shp' )
12
+ homo_raster = os .path .join (dat , 'homo_mount.tif' )
13
+
14
+ cir_center = os .path .join (dat , 'center.shp' )
15
+ cir_raster = os .path .join (dat , 'crater.tif' )
16
+
17
+ @pytest .fixture (scope = 'module' )
18
+ def base_homo (** kwargs ):
19
+ def _base_homo (** kwargs ):
20
+ return Base_curv (line = homo_line , raster = homo_raster , width = 100 , ** kwargs )
21
+
22
+ return _base_homo
23
+
24
+ @pytest .fixture (scope = 'module' )
25
+ def orig_homo (** kwargs ):
26
+ def _orig_homo (** kwargs ):
27
+ return Orig_curv (line = homo_line , raster = homo_raster , width = 100 , ** kwargs )
28
+
29
+ return _orig_homo
30
+
31
+ @pytest .fixture (scope = 'module' )
32
+ def elev_homo (** kwargs ):
33
+ def _elev_homo (** kwargs ):
34
+ return Elev_curv (line = homo_line , raster = homo_raster , width = 100 ,
35
+ min_elev = 0.01 ,
36
+ ** kwargs )
37
+
38
+ return _elev_homo
39
+
40
+ @pytest .fixture (scope = 'module' )
41
+ def slope_homo (** kwargs ):
42
+ def _slope_homo (** kwargs ):
43
+ return Slope_curv (line = homo_line , raster = homo_raster , width = 100 ,
44
+ min_slope = 1 ,
45
+ ** kwargs )
46
+
47
+ return _slope_homo
48
+
49
+ @pytest .fixture (scope = 'module' )
50
+ def tpi_homo (** kwargs ):
51
+ def _tpi_homo (** kwargs ):
52
+ return Tpi_curv (line = homo_line , raster = homo_raster , width = 100 ,
53
+ tpi_radius = 50 , min_tpi = - 5 ,
54
+ ** kwargs )
55
+
56
+ return _tpi_homo
57
+
58
+ @pytest .fixture (scope = 'module' )
59
+ def base_cir (** kwargs ):
60
+ def _base_cir (** kwargs ):
61
+ return Base_cir (cir_center , cir_raster , radius = 80 ,
62
+ ng_start = 0 , ng_end = 300 ,
63
+ ng_stepsize = 1 , radial_stepsize = None , ** kwargs )
64
+
65
+ return _base_cir
66
+
67
+ @pytest .fixture (scope = 'module' )
68
+ def orig_cir (** kwargs ):
69
+ def _orig_cir (** kwargs ):
70
+ return Orig_cir (cir_center , cir_raster , radius = 80 ,
71
+ ng_start = 0 , ng_end = 300 ,
72
+ ng_stepsize = 1 , radial_stepsize = None , ** kwargs )
73
+
74
+ return _orig_cir
75
+
76
+ @pytest .fixture (scope = 'module' )
77
+ def elev_cir (** kwargs ):
78
+ def _elev_cir (** kwargs ):
79
+ return Elev_cir (cir_center , cir_raster , radius = 80 ,
80
+ min_elev = 4 ,
81
+ ng_start = 0 , ng_end = 300 ,
82
+ ng_stepsize = 1 , radial_stepsize = None , ** kwargs )
83
+
84
+ return _elev_cir
85
+
86
+ @pytest .fixture (scope = 'module' )
87
+ def slope_cir (** kwargs ):
88
+ def _slope_cir (** kwargs ):
89
+ return Slope_cir (cir_center , cir_raster , radius = 80 ,
90
+ min_slope = 13 ,
91
+ ng_start = 0 , ng_end = 300 ,
92
+ ng_stepsize = 1 , radial_stepsize = None , ** kwargs )
93
+
94
+ return _slope_cir
95
+
96
+ @pytest .fixture (scope = 'module' )
97
+ def tpi_cir (** kwargs ):
98
+ def _tpi_cir (** kwargs ):
99
+ return Tpi_cir (cir_center , cir_raster , radius = 80 ,
100
+ tpi_radius = 50 , min_tpi = 2 ,
101
+ ng_start = 0 , ng_end = 300 ,
102
+ ng_stepsize = 1 , radial_stepsize = None , ** kwargs )
103
+
104
+ return _tpi_cir
105
+
106
+
107
+
108
+
109
+
0 commit comments