[GRASS-SVN] r52676 - in grass/trunk: lib/python lib/python/temporal lib/vector temporal temporal/t.rast.import temporal/t.rast.list temporal/t.rast.out.vtk

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 15 08:26:30 PDT 2012


Author: huhabla
Date: 2012-08-15 08:26:29 -0700 (Wed, 15 Aug 2012)
New Revision: 52676

Modified:
   grass/trunk/lib/python/core.py
   grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
   grass/trunk/lib/python/temporal/space_time_datasets_tools.py
   grass/trunk/lib/vector/vectorlib.dox
   grass/trunk/temporal/Makefile
   grass/trunk/temporal/t.rast.import/test.t.rast.import.sh
   grass/trunk/temporal/t.rast.list/test.t.rast.list.sh
   grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py
Log:
Small bugfixing and error message cleanup


Modified: grass/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/lib/python/core.py	2012-08-15 15:26:29 UTC (rev 52676)
@@ -614,7 +614,8 @@
         kvdict[key] = value_list
     return kvdict
 
-def compare_key_value_text_files(filename_a, filename_b, sep=":", val_sep=",", precision=0.000001):
+def compare_key_value_text_files(filename_a, filename_b, sep=":", 
+                                 val_sep=",", precision=0.000001):
     """
         !Compare two key-value text files that may contain projection parameter
         
@@ -661,7 +662,8 @@
     if missing_keys == len(dict_a):
         return False
     if missing_keys > 0:
-        grass.warning(_("Several keys (%i out of %i) are missing in the target file")%(missing_keys, len(dict_a)))
+        warning(_("Several keys (%i out of %i) are missing "
+                  "in the target file")%(missing_keys, len(dict_a)))
     return True
     
 # interface to g.gisenv

Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2012-08-15 15:26:29 UTC (rev 52676)
@@ -628,6 +628,12 @@
         dbif, connect = init_dbif(dbif)
 
         obj_list = []
+        
+        if self.get_map_time() == "point" or self.get_map_time() == "mixed":
+            core.error(_("The space time %(type)s dataset <%(name)s> must have"
+                         " interval time"%\
+                         {"type":self.get_new_map_instance(None).get_type(),
+                          "name":self.get_id()}))
 
         if gran is None:
             gran = self.get_granularity()
@@ -646,7 +652,11 @@
 
             if rows is not None:
                 if len(rows) > 1:
-                    core.warning(_("More than one map found in a granule. Temporal granularity seems to be invalid or the chosen granularity is not a greatest common divider of all intervals and gaps in the dataset."))
+                    core.warning(_("More than one map found in a granule. "
+                                   "Temporal granularity seems to be invalid or"
+                                   " the chosen granularity is not a greatest "
+                                   "common divider of all intervals and gaps "
+                                   "in the dataset."))
 
                 maplist = []
                 for row in rows:
@@ -656,7 +666,8 @@
                     if self.is_time_absolute():
                         map.set_absolute_time(start, next)
                     elif self.is_time_relative():
-                        map.set_relative_time(start, next, self.get_relative_time_unit())
+                        map.set_relative_time(start, next, 
+                                              self.get_relative_time_unit())
 
                     maplist.append(copy.copy(map))
 

Modified: grass/trunk/lib/python/temporal/space_time_datasets_tools.py
===================================================================
--- grass/trunk/lib/python/temporal/space_time_datasets_tools.py	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/lib/python/temporal/space_time_datasets_tools.py	2012-08-15 15:26:29 UTC (rev 52676)
@@ -418,14 +418,14 @@
         @param separator: The field separator character between the columns
         @param method: String identifier to select a method out of cols,
                        comma,delta or deltagaps
-            * "cols": Print preselected columns specified by columns
-            * "comma": Print the map ids (name at mapset) as comma separated string
-            * "delta": Print the map ids (name at mapset) with start time,
+            - "cols": Print preselected columns specified by columns
+            - "comma": Print the map ids (name at mapset) as comma separated string
+            - "delta": Print the map ids (name at mapset) with start time,
                        end time, relative length of intervals and the relative
                        distance to the begin
-            * "deltagaps": Same as "delta" with additional listing of gaps.
+            - "deltagaps": Same as "delta" with additional listing of gaps.
                            Gaps can be simply identified as the id is "None"
-            * "gran": List map using the granularity of the space time dataset,
+            - "gran": List map using the granularity of the space time dataset,
                       columns are identical to deltagaps
         @param header: Set True to print column names
     """
@@ -458,6 +458,8 @@
             maps = sp.get_registered_maps_as_objects(where, "start_time", None)
         elif method == "gran":
             maps = sp.get_registered_maps_as_objects_by_granularity(None)
+            
+        print "The maps object:", maps
 
         if header:
             string = ""
@@ -477,7 +479,8 @@
                 if len(maps[0]) > 0:
                     first_time, dummy = maps[0][0].get_valid_time()
                 else:
-                    core.fatal(_("Unable to list maps. Internal Error."))
+                    core.warning(_("Empty map list."))
+                    return
             else:
                 first_time, dummy = maps[0].get_valid_time()
 
@@ -487,7 +490,7 @@
                     if len(mymap) > 0:
                         map = mymap[0]
                     else:
-                        core.fatal(_("Unable to list maps. Internal Error."))
+                        core.error(_("Empty entry in map list, continue to next entry"))
                 else:
                     map = mymap
 

Modified: grass/trunk/lib/vector/vectorlib.dox
===================================================================
--- grass/trunk/lib/vector/vectorlib.dox	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/lib/vector/vectorlib.dox	2012-08-15 15:26:29 UTC (rev 52676)
@@ -1,4 +1,4 @@
-/*! \page vectorlib GRASS Vector Library
+/*! \mainpage vectorlib GRASS Vector Library
 
 by GRASS Development Team (http://grass.osgeo.org)
 

Modified: grass/trunk/temporal/Makefile
===================================================================
--- grass/trunk/temporal/Makefile	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/temporal/Makefile	2012-08-15 15:26:29 UTC (rev 52676)
@@ -28,7 +28,9 @@
 	t.rast3d.univar \
 	t.vect.list \
 	t.vect.db.select \
+	t.vect.export \
 	t.vect.extract \
+	t.vect.import \
 	t.vect.what.strds \
 	t.vect.observe.strds \
 	t.vect.univar

Modified: grass/trunk/temporal/t.rast.import/test.t.rast.import.sh
===================================================================
--- grass/trunk/temporal/t.rast.import/test.t.rast.import.sh	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/temporal/t.rast.import/test.t.rast.import.sh	2012-08-15 15:26:29 UTC (rev 52676)
@@ -73,9 +73,9 @@
 t.remove type=strds input=precip_abs1
 g.remove rast=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 rm -rf test
-#rm strds_export.tar.bz2
-#rm strds_export.tar.gz
-#rm strds_export.tar
-#rm strds_export_pack.tar  
-#rm strds_export_pack.tar.gz
-#rm strds_export_pack.tar.bz2
+rm strds_export.tar.bz2
+rm strds_export.tar.gz
+rm strds_export.tar
+rm strds_export_pack.tar  
+rm strds_export_pack.tar.gz
+rm strds_export_pack.tar.bz2

Modified: grass/trunk/temporal/t.rast.list/test.t.rast.list.sh
===================================================================
--- grass/trunk/temporal/t.rast.list/test.t.rast.list.sh	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/temporal/t.rast.list/test.t.rast.list.sh	2012-08-15 15:26:29 UTC (rev 52676)
@@ -87,7 +87,6 @@
 t.rast.list -h fs=" | " method=cols      input=precip_abs1
 t.rast.list -h fs=" | " method=delta     input=precip_abs1
 t.rast.list -h fs=" | " method=deltagaps input=precip_abs1
-t.rast.list -h fs=" | " method=gran      input=precip_abs1
 
 t.register type=rast -i input=precip_abs2 file="${n2}" 
 t.rast.list    fs=" | " method=comma     input=precip_abs2
@@ -115,7 +114,10 @@
 t.rast.list -h fs=" | " method=cols      input=precip_abs5
 t.rast.list -h fs=" | " method=delta     input=precip_abs5
 t.rast.list -h fs=" | " method=deltagaps input=precip_abs5
+
+# @test of @failure, time instances and mixed time is not supported
 t.rast.list -h fs=" | " method=gran      input=precip_abs5
+t.rast.list -h fs=" | " method=gran      input=precip_abs1
 
 t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 t.remove type=strds input=precip_abs0,precip_abs1,precip_abs2,precip_abs3,precip_abs4,precip_abs5

Modified: grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py
===================================================================
--- grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py	2012-08-14 10:18:31 UTC (rev 52675)
+++ grass/trunk/temporal/t.rast.out.vtk/t.rast.out.vtk.py	2012-08-15 15:26:29 UTC (rev 52676)
@@ -124,7 +124,7 @@
     if maps is not None:
         for map in maps:
             if use_granularity:
-                if len(map[0]) > 0:
+                if len(map) > 0:
                     id = map[0].get_map_id()
                 else:
                     continue



More information about the grass-commit mailing list