[GRASS-SVN] r58211 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 13 09:39:43 PST 2013
Author: huhabla
Date: 2013-11-13 09:39:43 -0800 (Wed, 13 Nov 2013)
New Revision: 58211
Modified:
grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
grass/trunk/lib/python/temporal/aggregation.py
grass/trunk/lib/python/temporal/extract.py
grass/trunk/lib/python/temporal/mapcalc.py
Log:
More usage of the PyGRASS message interface
Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2013-11-13 16:58:39 UTC (rev 58210)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2013-11-13 17:39:43 UTC (rev 58211)
@@ -2043,12 +2043,12 @@
statement += map.metadata.get_update_statement_mogrified(dbif)
if map.get_layer():
- core.verbose(_("Created register table <%s> for "
+ self.msgr.verbose(_("Created register table <%s> for "
"%s map <%s> with layer %s") %
(map_register_table, map.get_type(),
map.get_map_id(), map.get_layer()))
else:
- core.verbose(_("Created register table <%s> for %s map <%s>") %
+ self.msgr.verbose(_("Created register table <%s> for %s map <%s>") %
(map_register_table, map.get_type(),
map.get_map_id()))
Modified: grass/trunk/lib/python/temporal/aggregation.py
===================================================================
--- grass/trunk/lib/python/temporal/aggregation.py 2013-11-13 16:58:39 UTC (rev 58210)
+++ grass/trunk/lib/python/temporal/aggregation.py 2013-11-13 17:39:43 UTC (rev 58211)
@@ -120,7 +120,9 @@
@param dbif The temporal database interface to use
"""
- core.verbose(_("Aggregate %s raster maps") % (len(inputs)))
+ msgr = get_tgis_message_interface()
+
+ msgr.verbose(_("Aggregate %s raster maps") % (len(inputs)))
output = "%s_%i" % (base, count)
mapset = libgis.G_mapset()
@@ -134,11 +136,11 @@
new_map.delete(dbif)
new_map = RasterDataset(map_id)
else:
- core.error(_("Raster map <%s> is already in temporal database, " \
+ msgr.error(_("Raster map <%s> is already in temporal database, " \
"use overwrite flag to overwrite"))
return
- core.verbose(_("Compute aggregation of maps between %(st)s - %(end)s" % {
+ msgr.verbose(_("Compute aggregation of maps between %(st)s - %(end)s" % {
'st': str(start), 'end': str(end)}))
# Create the r.series input file
Modified: grass/trunk/lib/python/temporal/extract.py
===================================================================
--- grass/trunk/lib/python/temporal/extract.py 2013-11-13 16:58:39 UTC (rev 58210)
+++ grass/trunk/lib/python/temporal/extract.py 2013-11-13 17:39:43 UTC (rev 58211)
@@ -53,6 +53,7 @@
core.fatal(_("You need to specify the base name of new created maps"))
mapset = get_current_mapset()
+ msgr = get_tgis_message_interface()
dbif = SQLDatabaseInterfaceConnection()
dbif.connect()
@@ -108,25 +109,25 @@
new_map.delete(dbif)
new_map = sp.get_new_map_instance(map_id)
else:
- core.error(_("Map <%s> is already in temporal database"
+ msgr.error(_("Map <%s> is already in temporal database"
", use overwrite flag to overwrite") %
(new_map.get_map_id()))
continue
# Add process to the process list
if type == "raster":
- #core.verbose(_("Apply r.mapcalc expression: \"%s\"")
- # % expr)
+ msgr.verbose(_("Apply r.mapcalc expression: \"%s\"")
+ % expr)
proc_list.append(Process(target=run_mapcalc2d,
args=(expr,)))
elif type == "raster3d":
- #core.verbose(_("Apply r3.mapcalc expression: \"%s\"")
- # % expr)
+ msgr.verbose(_("Apply r3.mapcalc expression: \"%s\"")
+ % expr)
proc_list.append(Process(target=run_mapcalc3d,
args=(expr,)))
elif type == "vector":
- #core.verbose(_("Apply v.extract where statement: \"%s\"")
- # % expression)
+ msgr.verbose(_("Apply v.extract where statement: \"%s\"")
+ % expression)
if row["layer"]:
proc_list.append(Process(target=run_vector_extraction,
args=(row["name"] + "@" + \
Modified: grass/trunk/lib/python/temporal/mapcalc.py
===================================================================
--- grass/trunk/lib/python/temporal/mapcalc.py 2013-11-13 16:58:39 UTC (rev 58210)
+++ grass/trunk/lib/python/temporal/mapcalc.py 2013-11-13 17:39:43 UTC (rev 58211)
@@ -80,6 +80,7 @@
dbif.connect()
mapset = get_current_mapset()
+ msgr = get_tgis_message_interface()
input_name_list = inputs.split(",")
@@ -101,9 +102,9 @@
# Sample all inputs by the first input and create a sample matrix
if spatial:
- core.message(_("Start spatio-temporal sampling"))
+ msgr.message(_("Start spatio-temporal sampling"))
else:
- core.message(_("Start temporal sampling"))
+ msgr.message(_("Start temporal sampling"))
map_matrix = []
id_list = []
sample_map_list = []
@@ -120,7 +121,7 @@
# In case samples are not found
if not list and len(list) == 0:
dbif.close()
- core.message(_("No samples found for map calculation"))
+ msgr.message(_("No samples found for map calculation"))
return 0
# The fist entries are the samples
@@ -147,7 +148,7 @@
continue
if len(maplist) > 1:
- core.warning(_("Found more than a single map in a sample "
+ msgr.warning(_("Found more than a single map in a sample "
"granule. Only the first map is used for "
"computation. Use t.rast.aggregate.ds to "
"create synchronous raster datasets."))
@@ -165,7 +166,7 @@
if list is None:
dbif.close()
- core.message(_("No maps in input dataset"))
+ msgr.message(_("No maps in input dataset"))
return 0
map_name_list = []
@@ -181,7 +182,7 @@
if len(map_matrix) > 0:
- core.message(_("Start mapcalc computation"))
+ msgr.message(_("Start mapcalc computation"))
count = 0
# Get the number of samples
@@ -231,7 +232,7 @@
new_map.delete(dbif)
new_map = first_input.get_new_map_instance(map_id)
else:
- core.error(_("Map <%s> is already in temporal database, "
+ msgr.error(_("Map <%s> is already in temporal database, "
"use overwrite flag to overwrite"))
continue
@@ -251,7 +252,7 @@
map_list.append(new_map)
- #core.verbose(_("Apply mapcalc expression: \"%s\"") % expr)
+ msgr.verbose(_("Apply mapcalc expression: \"%s\"") % expr)
# Start the parallel r.mapcalc computation
if type == "raster":
@@ -276,7 +277,7 @@
proc_list = []
# Register the new maps in the output space time dataset
- core.message(_("Start map registration in temporal database"))
+ msgr.message(_("Start map registration in temporal database"))
temporal_type, semantic_type, title, description = first_input.get_initial_values()
More information about the grass-commit
mailing list