[GRASS-SVN] r74245 - in grass/trunk/scripts/r.fillnulls: . testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 13 11:42:04 PDT 2019
Author: lucadelu
Date: 2019-03-13 11:42:04 -0700 (Wed, 13 Mar 2019)
New Revision: 74245
Added:
grass/trunk/scripts/r.fillnulls/testsuite/
grass/trunk/scripts/r.fillnulls/testsuite/test_r_fillnulls.py
Log:
r.fillnulls: added test, thanks to Sanjeet Bhatti
Added: grass/trunk/scripts/r.fillnulls/testsuite/test_r_fillnulls.py
===================================================================
--- grass/trunk/scripts/r.fillnulls/testsuite/test_r_fillnulls.py (rev 0)
+++ grass/trunk/scripts/r.fillnulls/testsuite/test_r_fillnulls.py 2019-03-13 18:42:04 UTC (rev 74245)
@@ -0,0 +1,48 @@
+"""
+Created on Sun Jun 07 21:57:07 2018
+
+ at author: Sanjeet Bhatti
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+from grass.script.core import run_command
+
+
+class TestRFillNulls(TestCase):
+ """Test r.fillnulls script"""
+
+ mapName = 'elev_srtm_30m'
+ expression = 'elev_srtm_30m_filt = if(elev_srtm_30m < 50.0, \
+ null(), elev_srtm_30m)'
+ mapNameCalc = 'elev_srtm_30m_filt'
+ mapComplete = 'elev_srtm_30m_complete'
+ values = 'null_cells=0'
+
+ @classmethod
+ def setUpClass(cls):
+ """Create maps in a small region."""
+ cls.use_temp_region()
+ cls.runModule('g.region', raster=cls.mapName, flags='p')
+
+ @classmethod
+ def tearDownClass(cls):
+ """Remove temporary region"""
+ cls.runModule('g.remove', flags='f', type='raster',
+ name=(cls.mapNameCalc, cls.mapComplete))
+ cls.del_temp_region()
+
+ def test_fill_nulls(self):
+ """Fill nulls test"""
+ run_command('r.mapcalc', expression=self.expression)
+
+ module = SimpleModule('r.fillnulls', input=self.mapNameCalc,
+ output=self.mapComplete, tension=20)
+ self.assertModule(module)
+
+ self.assertRasterFitsUnivar(raster=self.mapComplete,
+ reference=self.values)
+
+if __name__ == '__main__':
+ test()
Property changes on: grass/trunk/scripts/r.fillnulls/testsuite/test_r_fillnulls.py
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
More information about the grass-commit
mailing list