[GRASS-SVN] r67939 - in grass/trunk: lib/python/temporal temporal/t.rast.accdetect/testsuite temporal/t.rast.accumulate/testsuite temporal/t.rast.contour/testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 24 07:09:51 PST 2016


Author: lucadelu
Date: 2016-02-24 07:09:50 -0800 (Wed, 24 Feb 2016)
New Revision: 67939

Modified:
   grass/trunk/lib/python/temporal/datetime_math.py
   grass/trunk/temporal/t.rast.accdetect/testsuite/test_simple.py
   grass/trunk/temporal/t.rast.accumulate/testsuite/test_accumulation.py
   grass/trunk/temporal/t.rast.contour/testsuite/test_convert.py
Log:
temporal framework: replace '.' with '_'

Modified: grass/trunk/lib/python/temporal/datetime_math.py
===================================================================
--- grass/trunk/lib/python/temporal/datetime_math.py	2016-02-24 13:28:49 UTC (rev 67938)
+++ grass/trunk/lib/python/temporal/datetime_math.py	2016-02-24 15:09:50 UTC (rev 67939)
@@ -868,10 +868,10 @@
        :param end: True if you want add also end time to the suffix    
     """
     start = mapp.temporal_extent.get_start_time()
-    sstring = start.isoformat().replace(':', '.').replace('-', '_')
+    sstring = start.isoformat().replace(':', '_').replace('-', '_')
     if end:
         end = mapp.temporal_extent.get_end_time()
-        estring = end.isoformat().replace(':', '.').replace('-', '_')
+        estring = end.isoformat().replace(':', '_').replace('-', '_')
         return "{st}_{en}".format(st=sstring, en=estring)
     return sstring
 

Modified: grass/trunk/temporal/t.rast.accdetect/testsuite/test_simple.py
===================================================================
--- grass/trunk/temporal/t.rast.accdetect/testsuite/test_simple.py	2016-02-24 13:28:49 UTC (rev 67938)
+++ grass/trunk/temporal/t.rast.accdetect/testsuite/test_simple.py	2016-02-24 15:09:50 UTC (rev 67939)
@@ -81,7 +81,7 @@
                           start="2001-01-01", cycle="12 months", suffix='time',
                           basename='b_occu', range=(1,8))
         self.assertRasterDoesNotExist('b_occu_2001_01')
-        self.assertRasterExists('b_occu_2001_01_01T00.00.00')
+        self.assertRasterExists('b_occu_2001_01_01T00_00_00')
 
     def test_num_suffix(self):
         self.assertModule('t.rast.accdetect', input='A', occurrence='B',

Modified: grass/trunk/temporal/t.rast.accumulate/testsuite/test_accumulation.py
===================================================================
--- grass/trunk/temporal/t.rast.accumulate/testsuite/test_accumulation.py	2016-02-24 13:28:49 UTC (rev 67938)
+++ grass/trunk/temporal/t.rast.accumulate/testsuite/test_accumulation.py	2016-02-24 15:09:50 UTC (rev 67939)
@@ -227,6 +227,14 @@
         self.assertRasterExists('b_001')
         self.assertRasterDoesNotExist('b_2001_01_07')
 
+    def test_time_suffix(self):
+        self.assertModule("t.rast.accumulate",  input="A", output="B",
+                          limits=[0,40], method="gdd",
+                          start="2001-01-01", cycle="7 days",
+                          basename="b", stop="2001-01-05", suffix="time",
+                          overwrite=True,  verbose=True)
+        self.assertRasterExists('b_2001_01_01T00_00_00')
+
 if __name__ == '__main__':
     from grass.gunittest.main import test
     test()

Modified: grass/trunk/temporal/t.rast.contour/testsuite/test_convert.py
===================================================================
--- grass/trunk/temporal/t.rast.contour/testsuite/test_convert.py	2016-02-24 13:28:49 UTC (rev 67938)
+++ grass/trunk/temporal/t.rast.contour/testsuite/test_convert.py	2016-02-24 15:09:50 UTC (rev 67939)
@@ -175,7 +175,7 @@
         self.assertModuleKeyValue(module=info, reference=tinfo_string, precision=2, sep="=")
 
 
-    def test_time_num(self):
+    def test_suffix_num(self):
         """Test the -s flag"""
         self.assertModule("t.rast.contour", input="A", output="result",
                           step=1, minlevel=1, maxlevel=8,
@@ -183,11 +183,23 @@
                           where="start_time > '2001-02-01'",
                           nprocs=1, overwrite=True, verbose=True)
 
-        self.assertVectorExists('time_004')
+        self.assertVectorExists('time_001')
         self.assertVectorDoesNotExist('time_00005')
         self.assertVectorDoesNotExist('time_2001_07')
 
+    def test_suffix_time(self):
+        """Test the -s flag"""
+        self.assertModule("t.rast.contour", input="A", output="result",
+                          step=1, minlevel=1, maxlevel=8,
+                          basename="time", suffix='time',
+                          where="start_time > '2001-02-01'",
+                          nprocs=1, overwrite=True, verbose=True)
 
+        self.assertVectorExists('time_2001_07_01T00_00_00')
+        self.assertVectorDoesNotExist('time_00005')
+        self.assertVectorDoesNotExist('time_2001_07')
+
+
 class TestRasterContourFails(TestCase):
     @classmethod
     def setUpClass(cls):



More information about the grass-commit mailing list