Explorar el Código

Small bugfixing and error message cleanup

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52676 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert hace 12 años
padre
commit
96c293567e

+ 4 - 2
lib/python/core.py

@@ -614,7 +614,8 @@ def _text_to_key_value_dict(filename, sep=":", val_sep=","):
         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 @@ def compare_key_value_text_files(filename_a, filename_b, sep=":", val_sep=",", p
     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

+ 13 - 2
lib/python/temporal/abstract_space_time_dataset.py

@@ -628,6 +628,12 @@ class AbstractSpaceTimeDataset(AbstractDataset):
         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 @@ class AbstractSpaceTimeDataset(AbstractDataset):
 
             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 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                     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))
 

+ 10 - 7
lib/python/temporal/space_time_datasets_tools.py

@@ -418,14 +418,14 @@ def list_maps_of_stds(type, input, columns, order, where, separator, method, hea
         @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@mapset) as comma separated string
-            * "delta": Print the map ids (name@mapset) with start time,
+            - "cols": Print preselected columns specified by columns
+            - "comma": Print the map ids (name@mapset) as comma separated string
+            - "delta": Print the map ids (name@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 @@ def list_maps_of_stds(type, input, columns, order, where, separator, method, hea
             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 @@ def list_maps_of_stds(type, input, columns, order, where, separator, method, hea
                 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 @@ def list_maps_of_stds(type, input, columns, order, where, separator, method, hea
                     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
 

+ 1 - 1
lib/vector/vectorlib.dox

@@ -1,4 +1,4 @@
-/*! \page vectorlib GRASS Vector Library
+/*! \mainpage vectorlib GRASS Vector Library
 
 by GRASS Development Team (http://grass.osgeo.org)
 

+ 2 - 0
temporal/Makefile

@@ -28,7 +28,9 @@ SUBDIRS = \
 	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

+ 6 - 6
temporal/t.rast.import/test.t.rast.import.sh

@@ -73,9 +73,9 @@ t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
 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

+ 3 - 1
temporal/t.rast.list/test.t.rast.list.sh

@@ -87,7 +87,6 @@ t.rast.list -h input=precip_abs1
 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 input=precip_abs5
 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

+ 1 - 1
temporal/t.rast.out.vtk/t.rast.out.vtk.py

@@ -124,7 +124,7 @@ def main():
     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