Hello all,
Luca, I am so sorry, for the very very big delay was having my finals, and
today I finally completed writing test on r.basins.fill.
All, I am Sunveer Singh, 15 years old from India, Google Code-in 2017
Winner with OSGeo, I completed 16 tasks for GRASS GIS, within Google
Code-in, and contributed *test for r.info <http://r.info>, i.vi
<http://i.vi>, v.extract, v.univar, v.select, r.report, r.texture,
v.vect.stats, r.recode, r.in.ascii and r.to.vect.* And created a video on
*How to create a location: Link to Video.
<https://www.youtube.com/watch?v=trvy0B0Qz78>*
Due to my finals, I was unable to contribute to GRASS, but know I will
start Contributing again.
I have attached my test written in python for r.basins.fill. If any
improvement is needed in the test, please let me know.
Thank You for Your Precious Time.
Thank You
Sunveer
https://sunveersingh.github.io/
"""
Name: r.basins.fill
Purpose: Tests r.basins.fill and its flags/options.
Author: Sunveer Singh
Copyright: (C) 2017 by Sunveer Singh and the GRASS Development Team
Licence: This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
from grass.gunittest.case import TestCase
extract="""2 summit
3 ridge
4 shoulder
"""
class TestRasterbasin(TestCase):
cnetwork='elevation'
tnetwork='facility'
output='basinsoutput'
input="basin_50K"
@classmethod
def setUpClass(cls):
seed = 500
cls.use_temp_region()
cls.runModule('g.region', raster=cls.tnetwork, flags='p')
cls.runModule('r.watershed', elevation='elevation', stream=cls.cnetwork, threshold='50000', overwrite=True)
cls.runModule('r.geomorphon', elevation=cls.cnetwork, forms=cls.tnetwork, overwrite=True)
cls.runModule('r.mapcalc', seed=seed, expression='rand_cell = rand(1, 200)', overwrite=True)
cls.runModule('r.thin', input=cls.input, output=cls.output)
@classmethod
def tearDownClass(cls):
cls.del_temp_region()
def tearDown(cls):
cls.runModule('g.remove', flags='f', type='raster', name=cls.output)
def test_no1(self):
lakes='lakes'
self.assertModule('r.basins.fill', cnetwork=self.cnetwork, tnetwork=self.tnetwork, output=self.output, number='1', overwrite=True)
self.assertRasterMinMax(map=lakes, refmin=34300, refmax=43600,
msg="lakes in degrees must be between 34300 and 43600")
def test_no2(self):
soilsID='soilsID'
self.assertModule('r.basins.fill', cnetwork=self.cnetwork, tnetwork=self.tnetwork, output=self.output, number='3')
self.assertRasterMinMax(map=soilsID, refmin=18683, refmax=46555,
msg="soilsID in degrees must be between 18683 and 46555")
def test_no3(self):
roadsmajor='roadsmajor'
self.assertModule('r.basins.fill', cnetwork=self.cnetwork, tnetwork=self.tnetwork, output=self.output, number='4')
self.assertRasterMinMax(map=roadsmajor, refmin=1, refmax=1,
msg="roadsmajor in degrees must be between 1 and 1")
def test_no4(self):
slope='slope'
self.assertModule('r.basins.fill', cnetwork=self.cnetwork, tnetwork=self.tnetwork, output=self.output, number='5')
self.assertRasterMinMax(map=slope, refmin=0, refmax=38.68939,
msg="slope in degrees must be between 0 and 38.68939")
if __name__ == '__main__':
from grass.gunittest.main import test
test()
_______________________________________________
grass-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-dev