[GRASS-SVN] r61561 - in grass-addons/grass7/raster3d/r3.flow/testsuite: . data

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 7 11:38:45 PDT 2014


Author: annakrat
Date: 2014-08-07 11:38:45 -0700 (Thu, 07 Aug 2014)
New Revision: 61561

Added:
   grass-addons/grass7/raster3d/r3.flow/testsuite/data/
   grass-addons/grass7/raster3d/r3.flow/testsuite/data/flowline.ascii
Modified:
   grass-addons/grass7/raster3d/r3.flow/testsuite/r3flow_test.py
Log:
r3.flow: more tests

Added: grass-addons/grass7/raster3d/r3.flow/testsuite/data/flowline.ascii
===================================================================
--- grass-addons/grass7/raster3d/r3.flow/testsuite/data/flowline.ascii	                        (rev 0)
+++ grass-addons/grass7/raster3d/r3.flow/testsuite/data/flowline.ascii	2014-08-07 18:38:45 UTC (rev 61561)
@@ -0,0 +1,220 @@
+ORGANIZATION: 
+DIGIT DATE:   
+DIGIT NAME:   anna
+MAP NAME:     
+MAP DATE:     Thu Aug  7 14:07:09 2014
+MAP SCALE:    1
+OTHER INFO:   
+ZONE:         0
+MAP THRESH:   0.000000
+VERTI:
+L  29 1
+ 84.806094    35.197336    39.43322    
+ 84.806094    35.197336    39.43322    
+ 81.397053    37.087846    37.746534   
+ 77.990596    38.976923    36.061127   
+ 74.586931    40.864452    34.377101   
+ 71.186292    42.750303    32.694572   
+ 67.78894     44.634331    31.013669   
+ 64.395174    46.516369    29.334541   
+ 61.005337    48.39623     27.657357   
+ 57.619819    50.273695    25.982309   
+ 54.239073    52.148514    24.309623   
+ 50.863626    54.020394    22.639558   
+ 47.494096    55.888993    20.972421   
+ 44.131215    57.753905    19.308574   
+ 40.775859    59.614643    17.64845    
+ 37.429084    61.470623    15.992571   
+ 34.092185    63.321127    14.341579   
+ 30.766765    65.165264    12.696266   
+ 27.454848    67.001913    11.057634   
+ 24.159033    68.829633    9.426969    
+ 20.882729    70.646532    7.805957    
+ 17.63053     72.450064    6.196872    
+ 16.2203      73.232118    5.499135    
+ 15.524693    73.617873    5.15497     
+ 14.844693    73.994972    4.816822    
+ 13.957167    74.487156    4.359276    
+ 13.294472    74.854659    4.003445    
+ 12.641464    75.219149    3.639976    
+ 10.056633    76.803483    2.055642    
+ 1     1         
+L  11 1
+ 14.429159    56.869515    22.42339    
+ 14.429159    56.869515    22.42339    
+ 12.601355    59.515898    19.843526   
+ 10.782742    62.148975    17.276635   
+ 8.975302     64.765875    14.725514   
+ 7.181717     67.362715    12.193949   
+ 5.405736     69.934067    9.687231    
+ 5.028815     70.479791    9.155225    
+ 4.652154     71.016388    8.632116    
+ 2.867253     73.302256    6.403706    
+ 2.265763     73.985122    5.738005    
+ 1     2         
+L  3 1
+ 29.06094     78.060291    39.317079   
+ 29.06094     78.060291    39.317079   
+ 26.687827    78.782477    36.229394   
+ 1     3         
+L  15 1
+ 64.955248    50.766146    12.023014   
+ 64.955248    50.766146    12.023014   
+ 61.256917    52.57599     11.123057   
+ 57.564137    54.383119    10.22445    
+ 53.877539    56.187221    9.327348    
+ 50.197872    57.987932    8.431932    
+ 46.526023    59.784817    7.538419    
+ 42.863063    61.577353    6.647069    
+ 39.210293    63.364901    5.758198    
+ 38.018565    63.948095    5.468202    
+ 36.824201    64.532578    5.177563    
+ 36.071128    64.901108    4.994309    
+ 32.597809    66.600839    4.110713    
+ 29.181582    68.272631    3.158125    
+ 25.83767     69.909033    2.128626    
+ 1     4         
+L  25 1
+ 75.476779    18.36009     29.362122   
+ 75.476779    18.36009     29.362122   
+ 72.370137    20.932588    28.035642   
+ 69.265932    23.503067    26.710203   
+ 66.164365    26.071363    25.38589    
+ 63.065658    28.63729     24.062799   
+ 59.970067    31.200637    22.741038   
+ 56.877879    33.761166    21.42073    
+ 53.789424    36.318604    20.102016   
+ 50.705085    38.872634    18.785059   
+ 47.625301    41.422891    17.470047   
+ 44.550588    43.96895     16.157201   
+ 41.481554    46.510306    14.846779   
+ 38.41892     49.046362    13.53909    
+ 35.363553    51.576401    12.234504   
+ 32.316507    54.09955     10.93347    
+ 29.279077    56.614736    9.636543    
+ 26.252882    59.120619    8.344413    
+ 23.23998     61.615494    7.057958    
+ 20.243039    64.097152    5.778319    
+ 19.425572    64.774067    5.429276    
+ 18.800082    65.292013    5.162202    
+ 18.176085    65.808722    4.89522     
+ 15.400616    68.106988    3.619661    
+ 12.732901    70.316026    2.218227    
+ 1     5         
+L  27 1
+ 88.842317    31.231087    34.335553   
+ 88.842317    31.231087    34.335553   
+ 85.377082    33.216565    32.883043   
+ 81.91433     35.200622    31.431573   
+ 78.454253    37.183145    29.981225   
+ 74.99707     39.16401     28.532089   
+ 71.543022    41.143079    27.084269   
+ 68.092387    43.120192    25.637878   
+ 64.645478    45.095171    24.193049   
+ 61.202652    47.067809    22.749932   
+ 57.764323    49.037872    21.3087     
+ 54.330967    51.005085    19.869552   
+ 50.903141    52.969129    18.432722   
+ 47.4815      54.92963     16.998485   
+ 44.06682     56.886142    15.567166   
+ 40.660031    58.838132    14.139154   
+ 37.262263    60.784955    12.714924   
+ 33.874899    62.725815    11.295054   
+ 30.499664    64.659727    9.880269    
+ 27.138741    66.585438    8.471483    
+ 23.794948    68.501334    7.069877    
+ 20.472006    70.405283    5.677011    
+ 19.348268    71.049152    5.205978    
+ 18.653231    71.447388    4.914227    
+ 15.59501     73.199659    3.529718    
+ 12.680501    74.869588    2.003854    
+ 12.040711    75.238889    1.635283    
+ 1     6         
+L  12 1
+ 41.138221    64.704133    25.85159    
+ 41.138221    64.704133    25.85159    
+ 37.878495    66.138062    23.671884   
+ 34.62772     67.568054    21.498164   
+ 31.387297    68.993493    19.331366   
+ 28.158978    70.413607    17.172662   
+ 24.94499     71.827417    15.023541   
+ 21.748226    73.23365     12.885936   
+ 18.572528    74.630617    10.762419   
+ 17.773874    74.981939    10.228377   
+ 16.750722    75.441692    9.544218    
+ 13.85757     76.869017    7.609633    
+ 1     7         
+L  10 1
+ 14.157683    45.265562    10.630492   
+ 14.157683    45.265562    10.630492   
+ 12.464634    48.777068    9.249157    
+ 10.77904     52.273115    7.873903    
+ 9.102396     55.750597    6.505953    
+ 7.436691     59.205391    5.146927    
+ 7.088389     59.927794    4.861766    
+ 5.550659     63.11716     3.501194    
+ 5.214971     63.813401    3.177855    
+ 4.881477     64.503578    2.846669    
+ 1     8         
+L  30 1
+ 69.363152    2.929942     39.636635   
+ 69.363152    2.929942     39.636635   
+ 68.798791    3.539399     39.297875   
+ 68.116225    4.282763     38.888164   
+ 67.559167    4.894601     38.553789   
+ 67.016431    5.493706     38.22801    
+ 64.370003    8.415368     36.639487   
+ 61.725453    11.334957    35.05209    
+ 59.082925    14.252313    33.465907   
+ 56.442583    17.167257    31.881036   
+ 53.80461     20.079585    30.297588   
+ 51.169212    22.989069    28.715685   
+ 48.536626    25.89545     27.13547    
+ 45.90712     28.798431    25.557103   
+ 43.281002    31.697671    23.98077    
+ 40.65863     34.592775    22.406686   
+ 38.040419    37.483285    20.8351     
+ 35.42686     40.36866     19.266306   
+ 32.818531    43.248261    17.700651   
+ 30.216125    46.121322    16.138551   
+ 27.620482    48.986918    14.580511   
+ 25.032628    51.843914    13.027147   
+ 22.453842    54.6909      11.479225   
+ 19.885737    57.526093    9.937715    
+ 17.33039     60.347202    8.403862    
+ 14.790534    63.151208    6.879309    
+ 12.269864    65.934034    5.366271    
+ 11.73894     66.520174    5.047583    
+ 11.214399    67.099269    4.729052    
+ 8.923633     69.62828     3.205931    
+ 1     9         
+L  28 1
+ 95.880286    0.802102     28.572064   
+ 95.880286    0.802102     28.572064   
+ 93.148886    2.998018     27.663079   
+ 92.408842    3.603505     27.416799   
+ 91.636987    4.239939     27.159932   
+ 90.785863    4.947655     26.876686   
+ 90.140973    5.486583     26.662072   
+ 75.332663    17.862527    21.733998   
+ 72.17706     20.499801    20.683841   
+ 69.024022    23.13493     19.634538   
+ 65.873765    25.767736    18.586161   
+ 62.726529    28.398017    17.538788   
+ 59.582587    31.025545    16.492512   
+ 56.442251    33.65006     15.447436   
+ 53.305878    36.271261    14.403679   
+ 50.173883    38.888805    13.361379   
+ 47.046745    41.502289    12.320695   
+ 43.925029    44.111242    11.281816   
+ 40.809402    46.715106    10.244963   
+ 37.70066     49.313216    9.210401    
+ 34.599764    51.904768    8.17845     
+ 31.507889    54.488782    7.149502    
+ 28.426489    57.064041    6.124039    
+ 25.357395    59.629015    5.102672    
+ 24.603013    60.259484    4.85051     
+ 21.709165    62.677998    3.821816    
+ 18.883632    65.039418    2.703682    
+ 16.147183    67.326387    1.486815    
+ 1     10        

Modified: grass-addons/grass7/raster3d/r3.flow/testsuite/r3flow_test.py
===================================================================
--- grass-addons/grass7/raster3d/r3.flow/testsuite/r3flow_test.py	2014-08-07 18:37:02 UTC (rev 61560)
+++ grass-addons/grass7/raster3d/r3.flow/testsuite/r3flow_test.py	2014-08-07 18:38:45 UTC (rev 61561)
@@ -4,9 +4,37 @@
 
 @author Anna Petrasova
 """
+import os
 from grass.gunittest import TestCase, test
 
+seeds = """
+84.80609404|35.19733594|39.43321996
+14.42915927|56.86951467|22.42338987
+29.06094033|78.06029074|39.31707858
+64.95524796|50.76614609|12.02301418
+75.47677891|18.36008965|29.362122
+88.84231714|31.23108675|34.33555293
+41.13822083|64.70413255|25.85158957
+14.15768282|45.26556161|10.63049231
+69.36315244|2.92994235|39.63663467
+95.88028571|0.80210167|28.57206445
+"""
 
+flowaccum = """
+n=480
+null_cells=0
+cells=480
+min=0
+max=91
+range=91
+mean=6.38333333333333
+mean_of_abs=6.38333333333333
+stddev=11.3685848821312
+variance=129.244722222222
+coeff_var=178.097935490306
+sum=3064
+"""
+
 class FlowlineTest(TestCase):
 
     @classmethod
@@ -14,16 +42,21 @@
         """Use temporary region settings"""
         cls.use_temp_region()
         cls.runModule("g.region", res=10, res3=10, n=80, s=0, w=0, e=120, b=0, t=50)
-        cls.runModule("r3.mapcalc", expression="map_1 = 100", overwrite=True)
-        cls.runModule("r3.mapcalc", expression="map_2 = -20", overwrite=True)
-        cls.runModule("r3.mapcalc", expression="map_3 = 0.01", overwrite=True)
-        cls.runModule("r3.mapcalc", expression="map_4 = col() + row() + depth()", overwrite=True)
+        cls.runModule("r3.mapcalc", expression="map_1 = 100")
+        cls.runModule("r3.mapcalc", expression="map_2 = -20")
+        cls.runModule("r3.mapcalc", expression="map_3 = 0.01")
+        cls.runModule("r3.mapcalc", expression="map_4 = col() + row() + depth()")
+        cls.runModule("r3.mapcalc", expression="map_5 = col() * col() + row() * row() + depth() * depth()")
+        cls.runModule('v.in.ascii', input='-', output='test_seeds', z=3, flags='zt',
+                      stdin=seeds)
 
     @classmethod
     def tearDownClass(cls):
         """!Remove the temporary region"""
         cls.del_temp_region()
-        cls.runModule('g.remove', rast3d=['map_1', 'map_2', 'map_3', 'map_4'])
+        cls.runModule('g.remove', rast3d=['map_1', 'map_2', 'map_3', 'map_4', 'map_5', 'test_flowaccum'])
+        cls.runModule('g.remove', vect=['test_flowline', 'test_seeds'])
+        os.remove('./data/flowline_tmp.ascii')
 
     def test_interpolation(self):
         self.assertModuleKeyValue('test.r3flow', test='interpolation',
@@ -47,6 +80,17 @@
                                   reference={'return': 0, 'values': [18.1, 18.1, 18.1]},
                                   precision=1e-10, sep='=')
 
+    def test_flowlines(self):
+        self.assertModule('r3.flow', input='map_5', flowline='test_flowline',
+                          seed_points='test_seeds', flowaccumulation='test_flowaccum',
+                          direction='down')
+        self.runModule('v.out.ascii', input='test_flowline',
+                       format='standard', output='./data/flowline_tmp.ascii',
+                       dp=6)
+        self.assertVectorAsciiEqualsVectorAscii(actual='./data/flowline_tmp.ascii',
+                                                reference='./data/flowline.ascii')
+        self.assertRaster3dFitsUnivar('test_flowaccum', reference=flowaccum, precision=1e-6)
 
+
 if __name__ == '__main__':
     test()



More information about the grass-commit mailing list