[GRASS-SVN] r50776 - grass/trunk/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 12 18:06:30 EST 2012


Author: huhabla
Date: 2012-02-12 15:06:30 -0800 (Sun, 12 Feb 2012)
New Revision: 50776

Modified:
   grass/trunk/lib/python/temporal/abstract_map_dataset.py
   grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
Log:
Correctly check return value of get_number_of_maps() when setting the relative time unit for a space
time dataset


Modified: grass/trunk/lib/python/temporal/abstract_map_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_map_dataset.py	2012-02-12 18:47:44 UTC (rev 50775)
+++ grass/trunk/lib/python/temporal/abstract_map_dataset.py	2012-02-12 23:06:30 UTC (rev 50776)
@@ -81,6 +81,7 @@
 	if name.find("@") >= 0:
 	    name, mapset = name.split("@")[0]
 
+        # Check for layer number in map name
 	if name.find(":") >= 0:
 	    name, layer = name.split(":")[0]
 	    

Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2012-02-12 18:47:44 UTC (rev 50775)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2012-02-12 23:06:30 UTC (rev 50776)
@@ -893,7 +893,9 @@
 		core.fatal(_("Temporal type of space time dataset <%s> and map <%s> are different") % (self.get_id(), map.get_map_id()))
 
         # In case no map has been registered yet, set the relative time unit from the first map
-        if self.metadata.get_number_of_maps() == None and self.map_counter == 0 and self.is_time_relative():
+        if (self.metadata.get_number_of_maps() == None or  self.metadata.get_number_of_maps() == 0) and \
+            self.map_counter == 0 and self.is_time_relative():
+
             self.set_relative_time_unit(map_rel_time_unit)
             self.relative_time.update()
             core.verbose(_("Set temporal unit for space time %s dataset <%s> to %s") %  (map.get_type(), self.get_id(), map_rel_time_unit))



More information about the grass-commit mailing list