Exemplo n.º 1
0
                                  input=['map_4', 'map_4', 'map_4'],
                                  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()
Exemplo n.º 2
0
        self.assertEqual(start, datetime.datetime(2001, 1, 2))
        self.assertEqual(end, datetime.datetime(2001, 1, 4))

    def test_temporal_neighbors_2(self):
        """Simple temporal neighborhood computation test"""
        tra = tgis.TemporalRaster3DAlgebraParser(run = True, debug = True)
        tra.parse(expression='D = A[0,0,0,-1] + A[0,0,0,1]',
                  basename="d", overwrite=True)

        D = tgis.open_old_stds("D", type="str3ds")
        D.select()
        self.assertEqual(D.metadata.get_number_of_maps(), 2)
        self.assertEqual(D.metadata.get_min_min(), 4)  # 1 + 3
        self.assertEqual(D.metadata.get_max_max(), 6) # 2 + 4
        start, end = D.get_absolute_time()
        self.assertEqual(start, datetime.datetime(2001, 1, 2))
        self.assertEqual(end, datetime.datetime(2001, 1, 4))

    def tearDown(self):
        ret = grass.script.run_command("t.remove", type="str3ds", flags="rf", input="D", quiet=True)

    @classmethod
    def tearDownClass(cls):
        """!Remove the temporary region
        """
        ret = grass.script.run_command("t.remove", type="str3ds", flags="rf", input="A", quiet=True)
        grass.script.del_temp_region()

if __name__ == '__main__':
    gunittest.test()
Exemplo n.º 3
0
# -*- coding: utf-8 -*-

from grass.gunittest import TestCase, test


class TestFail(TestCase):
    # pylint: disable=R0904

    def test_something(self):
        self.assertTrue(False)


if __name__ == '__main__':
    test()
        self.assertEqual(end, datetime.datetime(2001, 1, 4))

    def test_temporal_neighbors_2(self):
        """Simple temporal neighborhood computation test"""
        tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
        tra.parse(expression='D = A[0,0,-1] + A[0,0,1]',
                  basename="d", overwrite=True)

        D = tgis.open_old_stds("D", type="strds")
        D.select()
        self.assertEqual(D.metadata.get_number_of_maps(), 2)
        self.assertEqual(D.metadata.get_min_min(), 4)  # 1 + 3
        self.assertEqual(D.metadata.get_max_max(), 6) # 2 + 4
        start, end = D.get_absolute_time()
        self.assertEqual(start, datetime.datetime(2001, 1, 2))
        self.assertEqual(end, datetime.datetime(2001, 1, 4))

    def tearDown(self):
        ret = grass.script.run_command("t.remove", flags="rf", input="D", quiet=True)

    @classmethod
    def tearDownClass(cls):
        """!Remove the temporary region
        """
        ret = grass.script.run_command("t.remove", flags="rf", input="A,B,C", quiet=True)
        grass.script.del_temp_region()


if __name__ == '__main__':
    gunittest.test()