[GRASS-SVN] r51794 - in grass/trunk: lib/python/temporal temporal temporal/t.register

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 26 10:49:38 EDT 2012


Author: huhabla
Date: 2012-05-26 07:49:38 -0700 (Sat, 26 May 2012)
New Revision: 51794

Modified:
   grass/trunk/lib/python/temporal/datetime_math.py
   grass/trunk/temporal/run_all_tests.sh
   grass/trunk/temporal/t.register/test.t.register.raster.sh
Log:
Small fixes


Modified: grass/trunk/lib/python/temporal/datetime_math.py
===================================================================
--- grass/trunk/lib/python/temporal/datetime_math.py	2012-05-26 14:47:46 UTC (rev 51793)
+++ grass/trunk/lib/python/temporal/datetime_math.py	2012-05-26 14:49:38 UTC (rev 51794)
@@ -25,6 +25,9 @@
 import copy
 from dateutil import parser
 
+DAY_IN_SECONDS = 86400
+SECOND_AS_DAY  = 1.1574074074074073e-05
+
 ###############################################################################
 
 def relative_time_to_time_delta(value):
@@ -34,7 +37,7 @@
 
     days = int(value)
     seconds = value % 1
-    seconds = round(seconds * 86400)
+    seconds = round(seconds * DAY_IN_SECONDS)
 
     return timedelta(days, seconds)
 
@@ -45,7 +48,7 @@
        double value, representing days.
     """
 
-    return float(delta.days) + float(delta.seconds/86400.0)
+    return float(delta.days) + float(delta.seconds * SECOND_AS_DAY)
 
 ###############################################################################
 

Modified: grass/trunk/temporal/run_all_tests.sh
===================================================================
--- grass/trunk/temporal/run_all_tests.sh	2012-05-26 14:47:46 UTC (rev 51793)
+++ grass/trunk/temporal/run_all_tests.sh	2012-05-26 14:49:38 UTC (rev 51794)
@@ -2,6 +2,11 @@
 # This scripts runs all tests available in the temporal module directory
 # Logs a written to "run.log" 
 
+if [ -z "$GISBASE" ] ; then
+    echo "You must be in GRASS GIS to run this program." 1>&2
+    exit 1
+fi
+
 LOG_FILE="/tmp/run.log"
 echo "Logfile\n\n" > $LOG_FILE
 

Modified: grass/trunk/temporal/t.register/test.t.register.raster.sh
===================================================================
--- grass/trunk/temporal/t.register/test.t.register.raster.sh	2012-05-26 14:47:46 UTC (rev 51793)
+++ grass/trunk/temporal/t.register/test.t.register.raster.sh	2012-05-26 14:49:38 UTC (rev 51794)
@@ -1,8 +1,8 @@
 #!/bin/sh
 # This is a test to register and unregister raster maps in
-# space time raster input.
+# space time raster datasets.
 # The raster maps will be registered in different space time raster
-# inputs
+# datasets.
 
 # We need to set a specific region in the
 # @preprocess step of this test. We generate



More information about the grass-commit mailing list