[GRASS-SVN] r66062 - grass/trunk/lib/python/pygrass/raster/testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 29 15:01:27 PDT 2015


Author: huhabla
Date: 2015-08-29 15:01:27 -0700 (Sat, 29 Aug 2015)
New Revision: 66062

Modified:
   grass/trunk/lib/python/pygrass/raster/testsuite/test_raster_region.py
Log:
pygrass raster: Added computational raster region setting test


Modified: grass/trunk/lib/python/pygrass/raster/testsuite/test_raster_region.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/testsuite/test_raster_region.py	2015-08-29 21:44:57 UTC (rev 66061)
+++ grass/trunk/lib/python/pygrass/raster/testsuite/test_raster_region.py	2015-08-29 22:01:27 UTC (rev 66062)
@@ -4,6 +4,7 @@
 from unittest import skip
 
 from grass.pygrass.raster import RasterRow
+from grass.pygrass.raster import raster2numpy
 from grass.pygrass.gis.region import Region
 
 class RasterRowRegionTestCase(TestCase):
@@ -78,5 +79,35 @@
         
         rast.close()
 
+    def test_resampling_to_numpy(self):
+        
+        region = Region()
+        region.ewres = 0.1
+        region.nsres = 0.1
+        region.adjust()
+        region.set_raster_region()
+        
+        a = raster2numpy(self.name)
+        
+        self.assertEqual(len(a), 400)
+        
+        region.ewres = 1
+        region.nsres = 1
+        region.adjust()
+        region.set_raster_region()
+        
+        a = raster2numpy(self.name)
+        
+        self.assertEqual(len(a), 40)
+
+        region.ewres = 5
+        region.nsres = 5
+        region.adjust()
+        region.set_raster_region()
+        
+        a = raster2numpy(self.name)
+        
+        self.assertEqual(len(a), 8)
+
 if __name__ == '__main__':
     test()



More information about the grass-commit mailing list