[GRASS-SVN] r51182 - in grass/trunk/temporal: . tr.aggregate
tr.extract tr.mapcalc tv.what.strds
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 29 09:57:41 EDT 2012
Author: huhabla
Date: 2012-03-29 06:57:41 -0700 (Thu, 29 Mar 2012)
New Revision: 51182
Added:
grass/trunk/temporal/tr.mapcalc/
grass/trunk/temporal/tr.mapcalc/Makefile
grass/trunk/temporal/tr.mapcalc/test.tr.mapcalc.sh
grass/trunk/temporal/tr.mapcalc/tr.mapcalc.html
grass/trunk/temporal/tr.mapcalc/tr.mapcalc.py
Modified:
grass/trunk/temporal/Makefile
grass/trunk/temporal/tr.aggregate/tr.aggregate.py
grass/trunk/temporal/tr.extract/test.tr.extract.sh
grass/trunk/temporal/tr.extract/tr.extract.py
grass/trunk/temporal/tv.what.strds/tv.what.strds.py
Log:
New module tr.mapcalc, added parallel processing support for tr.extract and tr.mapcalc.
Modified: grass/trunk/temporal/Makefile
===================================================================
--- grass/trunk/temporal/Makefile 2012-03-29 13:56:23 UTC (rev 51181)
+++ grass/trunk/temporal/Makefile 2012-03-29 13:57:41 UTC (rev 51182)
@@ -15,6 +15,7 @@
tr.to.rast3 \
tr.univar \
tr.list \
+ tr.mapcalc \
tr.series \
tr.export \
tr.out.vtk \
Modified: grass/trunk/temporal/tr.aggregate/tr.aggregate.py
===================================================================
--- grass/trunk/temporal/tr.aggregate/tr.aggregate.py 2012-03-29 13:56:23 UTC (rev 51181)
+++ grass/trunk/temporal/tr.aggregate/tr.aggregate.py 2012-03-29 13:57:41 UTC (rev 51182)
@@ -29,7 +29,7 @@
#%option
#% key: granularity
#% type: string
-#% description: The aggregation granularity, format absolue time "x years, x months, x weeks, x days, x hours, x minutes, x seconds" or a double value for relative time
+#% description: The aggregation granularity, format absolute time "x years, x months, x weeks, x days, x hours, x minutes, x seconds" or a double value for relative time
#% required: yes
#% multiple: no
#%end
@@ -45,7 +45,7 @@
#%option
#% key: method
#% type: string
-#% description: Aggregate operation to be peformed on the raster maps
+#% description: Aggregate operation to be performed on the raster maps
#% required: yes
#% multiple: no
#% options: average,count,median,mode,minimum,min_raster,maximum,max_raster,stddev,range,sum,variance,diversity,slope,offset,detcoeff,quart1,quart3,perc90,quantile,skewness,kurtosis
@@ -58,11 +58,21 @@
#%option G_OPT_R_BASE
#%end
+#%option
+#% key: nprocs
+#% type: integer
+#% description: The number of r.mapcalc processes to run in parallel
+#% required: no
+#% multiple: no
+#% answer: 2
+#%end
+
#%flag
#% key: n
#% description: Register Null maps
#%end
+from multiprocessing import Process
import grass.script as grass
import grass.temporal as tgis
@@ -79,6 +89,7 @@
register_null = flags["n"]
method = options["method"]
sampling = options["sampling"]
+ nprocs = int(options["nprocs"])
# Make sure the temporal database exists
tgis.create_temporal_database()
@@ -114,7 +125,7 @@
new_sp = tgis.space_time_raster_dataset(out_id)
else:
dbif.close()
- grass.fatal(_("Space time raster dataset <%s> is already in database, use overwrite flag to overwrite") % out_id)
+ grass.fatal(_("Space time raster dataset <%s> is already in the database, use overwrite flag to overwrite") % out_id)
temporal_type, semantic_type, title, description = sp.get_initial_values()
new_sp.set_initial_values(temporal_type, semantic_type, title, description)
@@ -137,6 +148,8 @@
next_start_time = first_start_time
count = 0
+ proc_count = 0
+ proc_list = []
while next_start_time <= last_start_time:
start = next_start_time
if sp.is_time_absolute():
@@ -149,7 +162,7 @@
if input_map_names:
tgis.aggregate_raster_maps(sp, new_sp, mapset, input_map_names, base, start, end, count, method, register_null, dbif)
-
+
count += 1
# Update the spatio-temporal extent and the raster metadata table entries
Modified: grass/trunk/temporal/tr.extract/test.tr.extract.sh
===================================================================
--- grass/trunk/temporal/tr.extract/test.tr.extract.sh 2012-03-29 13:56:23 UTC (rev 51181)
+++ grass/trunk/temporal/tr.extract/test.tr.extract.sh 2012-03-29 13:57:41 UTC (rev 51182)
@@ -20,12 +20,12 @@
# The first @test
# We create the space time raster inputs and register the raster maps with absolute time interval
-tr.extract --o input=precip_abs1 output=precip_abs2 where="start_time > '2001-06-01'" \
- expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec
+tr.extract --o --v input=precip_abs1 output=precip_abs2 where="start_time > '2001-06-01'" \
+ expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec nprocs=2
t.info type=strds input=precip_abs2
-tr.extract --o -n input=precip_abs1 output=precip_abs3 where="start_time > '2001-06-01'" \
- expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec
+tr.extract --o --v -n input=precip_abs1 output=precip_abs3 where="start_time > '2001-06-01'" \
+ expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec nprocs=4
t.info type=strds input=precip_abs3
t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
Modified: grass/trunk/temporal/tr.extract/tr.extract.py
===================================================================
--- grass/trunk/temporal/tr.extract/tr.extract.py 2012-03-29 13:56:23 UTC (rev 51181)
+++ grass/trunk/temporal/tr.extract/tr.extract.py 2012-03-29 13:57:41 UTC (rev 51182)
@@ -40,6 +40,15 @@
#%option G_OPT_R_BASE
#%end
+#%option
+#% key: nprocs
+#% type: integer
+#% description: The number of r.mapcalc processes to run in parallel
+#% required: no
+#% multiple: no
+#% answer: 1
+#%end
+
#%flag
#% key: n
#% description: Register Null maps
@@ -47,6 +56,7 @@
import grass.script as grass
import grass.temporal as tgis
+from multiprocessing import Process
############################################################################
@@ -58,6 +68,7 @@
where = options["where"]
expression = options["expression"]
base = options["base"]
+ nprocs = int(options["nprocs"])
register_null = flags["n"]
# Make sure the temporal database exists
@@ -91,23 +102,79 @@
# The new space time raster dataset
new_sp = tgis.space_time_raster_dataset(out_id)
if new_sp.is_in_db():
- if grass.overwrite() == True:
- new_sp.delete(dbif)
- new_sp = tgis.space_time_raster_dataset(out_id)
- else:
+ if grass.overwrite() == False:
grass.fatal(_("Space time raster dataset <%s> is already in database, use overwrite flag to overwrite") % out_id)
-
- temporal_type, semantic_type, title, description = sp.get_initial_values()
- new_sp.set_initial_values(temporal_type, semantic_type, title, description)
- new_sp.insert(dbif)
-
+
rows = sp.get_registered_maps("id", where, "start_time", dbif)
+ new_maps = {}
if rows:
num_rows = len(rows)
grass.percent(0, num_rows, 1)
+ # Run the r.mapcalc expression
+ if expression:
+ count = 0
+ proc_count = 0
+ proc_list = []
+ for row in rows:
+ count += 1
+
+ grass.percent(count, num_rows, 1)
+
+ map_name = "%s_%i" % (base, count)
+
+ expr = "%s = %s" % (map_name, expression.replace(sp.get_id(), row["id"]))
+ expr = expr.replace(sp.base.get_name(), row["id"])
+
+ map_id = map_name + "@" + mapset
+
+ new_map = sp.get_new_map_instance(map_id)
+
+ # Check if new map is in the temporal database
+ if new_map.is_in_db(dbif):
+ if grass.overwrite() == True:
+ # Remove the existing temporal database entry
+ new_map.delete(dbif)
+ new_map = sp.get_new_map_instance(map_id)
+ else:
+ grass.error(_("Raster map <%s> is already in temporal database, use overwrite flag to overwrite"))
+ continue
+
+ grass.verbose(_("Apply r.mapcalc expression: \"%s\"") % expr)
+
+ proc_list.append(Process(target=run_mapcalc, args=(expr,)))
+ proc_list[proc_count].start()
+ proc_count += 1
+
+ if proc_count == nprocs:
+ proc_count = 0
+ exitcodes = 0
+ for proc in proc_list:
+ proc.join()
+ exitcodes += proc.exitcode
+
+ if exitcodes != 0:
+ grass.fatal(_("Error while r.mapcalc computation"))
+
+ # Empty proc list
+ proc_list = []
+ new_maps[row["id"]] = new_map
+
+ grass.percent(0, num_rows, 1)
+
+ # Insert the new space time raster dataset
+ if new_sp.is_in_db():
+ if grass.overwrite() == True:
+ new_sp.delete(dbif)
+ new_sp = tgis.space_time_raster_dataset(out_id)
+
+ temporal_type, semantic_type, title, description = sp.get_initial_values()
+ new_sp.set_initial_values(temporal_type, semantic_type, title, description)
+ new_sp.insert(dbif)
+
+ # Register the maps in the database
count = 0
for row in rows:
count += 1
@@ -118,34 +185,10 @@
old_map.select(dbif)
if expression:
+
+ if new_maps.has_key(row["id"]):
+ new_map = new_maps[row["id"]]
- map_name = "%s_%i" % (base, count)
-
- expr = "%s = %s" % (map_name, expression.replace(sp.get_id(), row["id"]))
- expr = expr.replace(sp.base.get_name(), row["id"])
-
- map_id = map_name + "@" + mapset
-
- new_map = sp.get_new_map_instance(map_id)
-
- # Check if new map is in the temporal database
- if new_map.is_in_db(dbif):
- if grass.overwrite() == True:
- # Remove the existing temporal database entry
- new_map.delete(dbif)
- new_map = sp.get_new_map_instance(map_id)
- else:
- grass.error(_("Raster map <%s> is already in temporal database, use overwrite flag to overwrite"))
- continue
-
- grass.verbose(_("Apply r.mapcalc expression: \"%s\"") % expr)
-
- ret = grass.run_command("r.mapcalc", expression=expr, overwrite=grass.overwrite(), quiet=True)
-
- if ret != 0:
- grass.error(_("Error while r.mapcalc computation, continue with next map"))
- break
-
# Read the raster map data
new_map.load()
@@ -167,8 +210,8 @@
new_sp.register_map(new_map, dbif)
else:
- new_sp.register_map(old_map, dbif)
-
+ new_sp.register_map(old_map, dbif)
+
# Update the spatio-temporal extent and the raster metadata table entries
new_sp.update_from_registered_maps(dbif)
@@ -176,6 +219,14 @@
dbif.close()
+###############################################################################
+
+def run_mapcalc(expr):
+ """Helper function to run r.mapcalc in parallel"""
+ return grass.run_command("r.mapcalc", expression=expr, overwrite=grass.overwrite(), quiet=True)
+
+###############################################################################
+
if __name__ == "__main__":
options, flags = grass.parser()
main()
Added: grass/trunk/temporal/tr.mapcalc/Makefile
===================================================================
--- grass/trunk/temporal/tr.mapcalc/Makefile (rev 0)
+++ grass/trunk/temporal/tr.mapcalc/Makefile 2012-03-29 13:57:41 UTC (rev 51182)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../../
+
+PGM = tr.mapcalc
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script $(TEST_DST)
Added: grass/trunk/temporal/tr.mapcalc/test.tr.mapcalc.sh
===================================================================
--- grass/trunk/temporal/tr.mapcalc/test.tr.mapcalc.sh (rev 0)
+++ grass/trunk/temporal/tr.mapcalc/test.tr.mapcalc.sh 2012-03-29 13:57:41 UTC (rev 51182)
@@ -0,0 +1,38 @@
+# Test for tr.mapcalc
+
+# We need to set a specific region in the
+# @preprocess step of this test. We generate
+# raster with r.mapcalc and create several space time raster inputs
+# with relative and absolute time
+# The region setting should work for UTM and LL test locations
+g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
+
+r.mapcalc --o expr="prec_1 = rand(0, 550)"
+r.mapcalc --o expr="prec_2 = rand(0, 450)"
+r.mapcalc --o expr="prec_3 = rand(0, 320)"
+r.mapcalc --o expr="prec_4 = rand(0, 510)"
+r.mapcalc --o expr="prec_5 = rand(0, 300)"
+r.mapcalc --o expr="prec_6 = rand(0, 650)"
+
+t.create --o type=strds temporaltype=absolute output=precip_abs1 title="A test" descr="A test"
+t.create --o type=strds temporaltype=absolute output=precip_abs2 title="A test" descr="A test"
+t.register -i type=rast input=precip_abs1 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="3 months"
+t.register type=rast input=precip_abs2 maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+
+t.info precip_abs1
+t.info precip_abs2
+
+# The first @test
+tr.mapcalc --o --v -n inputs=precip_abs1,precip_abs2 output=precip_abs3 \
+ expression=" precip_abs1 + precip_abs2" base=new_prec \
+ method=equal nprocs=6
+t.info type=strds input=precip_abs3
+
+tr.mapcalc --o --v -s inputs=precip_abs1,precip_abs2,precip_abs3 output=precip_abs4 \
+ expression=" (precip_abs1 + precip_abs2) / precip_abs3 at PERMANENT " base=new_prec \
+ method=equal nprocs=6
+t.info type=strds input=precip_abs4
+
+t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
+t.unregister type=rast maps=new_prec_1,new_prec_2,new_prec_3,new_prec_4,new_prec_5,new_prec_6
+t.remove type=strds input=precip_abs1,precip_abs2,precip_abs3,precip_abs4
Added: grass/trunk/temporal/tr.mapcalc/tr.mapcalc.html
===================================================================
Added: grass/trunk/temporal/tr.mapcalc/tr.mapcalc.py
===================================================================
--- grass/trunk/temporal/tr.mapcalc/tr.mapcalc.py (rev 0)
+++ grass/trunk/temporal/tr.mapcalc/tr.mapcalc.py 2012-03-29 13:57:41 UTC (rev 51182)
@@ -0,0 +1,362 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+############################################################################
+#
+# MODULE: tr.mapcalc
+# AUTHOR(S): Soeren Gebbert
+#
+# PURPOSE: Perform r.mapcalc expressions on maps of sampled space time raster datasets
+# COPYRIGHT: (C) 2012 by the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (version 2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
+#%module
+#% description: Perform r.mapcalc expressions on maps of sampled space time raster datasets
+#% keywords: temporal
+#% keywords: mapcalc
+#%end
+
+#%option G_OPT_STRDS_INPUTS
+#%end
+
+#%option
+#% key: expression
+#% type: string
+#% description: The r.mapcalc expression applied to each time step of the sampled data
+#% required: yes
+#% multiple: no
+#%end
+
+#%option G_OPT_T_SAMPLE
+#% key: method
+#% answer: during,overlap,contain,equal
+#%end
+
+#%option G_OPT_STRDS_OUTPUT
+#%end
+
+#%option G_OPT_R_BASE
+#% required: yes
+#%end
+
+#%option
+#% key: nprocs
+#% type: integer
+#% description: The number of r.mapcalc processes to run in parallel
+#% required: no
+#% multiple: no
+#% answer: 1
+#%end
+
+#%flag
+#% key: n
+#% description: Register Null maps
+#%end
+
+#%flag
+#% key: s
+#% description: Check spatial overlap
+#%end
+
+from multiprocessing import Process
+import copy
+import grass.script as grass
+import grass.temporal as tgis
+
+############################################################################
+
+def main():
+
+ # Get the options
+ inputs = options["inputs"]
+ output = options["output"]
+ expression = options["expression"]
+ base = options["base"]
+ method = options["method"]
+ nprocs = int(options["nprocs"])
+ register_null = flags["n"]
+ spatial = flags["s"]
+
+ # Create the method list
+ method = method.split(",")
+
+ # Make sure the temporal database exists
+ tgis.create_temporal_database()
+
+ # We need a database interface for fast computation
+ dbif = tgis.sql_database_interface()
+ dbif.connect()
+
+ mapset = grass.gisenv()["MAPSET"]
+
+ input_name_list = inputs.split(",")
+
+ # Process the first input
+ if input_name_list[0].find("@") >= 0:
+ id = input_name_list[0]
+ else:
+ id = input_name_list[0] + "@" + mapset
+
+ first_input = tgis.space_time_raster_dataset(id)
+
+ if first_input.is_in_db(dbif) == False:
+ dbif.close()
+ grass.fatal(_("Space time raster dataset <%s> not found in temporal database") % (id))
+
+ # Fill the object with data from the temporal database
+ first_input.select(dbif)
+
+ # All additional inputs in reverse sorted order to avoid wrong name substitution
+ input_name_list = input_name_list[1:]
+ input_name_list.sort()
+ input_name_list.reverse()
+ input_list = []
+
+ for input in input_name_list:
+
+ if input.find("@") >= 0:
+ id = input
+ else:
+ id = input + "@" + mapset
+
+ sp = tgis.space_time_raster_dataset(id)
+
+ if sp.is_in_db(dbif) == False:
+ dbif.close()
+ grass.fatal(_("Space time raster dataset <%s> not found in temporal database") % (id))
+
+ sp.select(dbif)
+
+ input_list.append(copy.copy(sp))
+
+ # Create the new space time raster dataset
+ if output.find("@") >= 0:
+ out_id = output
+ else:
+ out_id = output + "@" + mapset
+
+ new_sp = tgis.space_time_raster_dataset(out_id)
+
+ # Check if in database
+ if new_sp.is_in_db(dbif):
+ if grass.overwrite() == False:
+ dbif.close()
+ grass.fatal(_("Space time raster dataset <%s> is already in database, use overwrite flag to overwrite") % out_id)
+
+ # Sample all inputs by the first input and create a sample matrix
+ if spatial:
+ grass.message(_("Start spatio-temporal sampling"))
+ else:
+ grass.message(_("Start temporal sampling"))
+ map_matrix = []
+ id_list = []
+ sample_map_list = []
+ # First entry is the first dataset id
+ id_list.append(first_input.get_name())
+
+ if len(input_list) > 0:
+ has_samples = False
+ for dataset in input_list:
+ list = dataset.sample_by_dataset(stds=first_input, method=method, spatial=spatial, dbif=dbif)
+
+ # In case samples are not found
+ if not list and len(list) == 0:
+ dbif.close()
+ grass.message(_("No samples found for map calculation"))
+ return 0
+
+ # The fist entries are the samples
+ map_name_list = []
+ if has_samples == False:
+ for entry in list:
+ granule = entry["granule"]
+ # Do not consider gaps
+ if granule.get_id() == None:
+ continue
+ sample_map_list.append(granule)
+ map_name_list.append(granule.get_name())
+ # Attach the map names
+ map_matrix.append(copy.copy(map_name_list))
+ has_samples = True
+
+ map_name_list = []
+ for entry in list:
+ maplist = entry["samples"]
+ granule = entry["granule"]
+
+ # Do not consider gaps in the sampler
+ if granule.get_id() == None:
+ continue
+
+ if len(maplist) > 1:
+ grass.warning(_("Found more than a single map in a sample granule. "\
+ "Only the first map is used for computation. "\
+ "Use tr.aggregate.ds to create synchronous datasets."))
+
+ # Store all maps! This includes non existent maps, identified by id == None
+ map_name_list.append(maplist[0].get_name())
+
+ # Attach the map names
+ map_matrix.append(copy.copy(map_name_list))
+
+ id_list.append(dataset.get_name())
+ else:
+ list = first_input.get_registered_maps_as_objects(dbif=dbif)
+
+ if list == None:
+ dbif.close()
+ grass.message(_("No maps in input dataset"))
+ return 0
+
+ map_name_list = []
+ for map in list:
+ map_name_list.append(map.get_name())
+ sample_map_list.append(map)
+
+ # Attach the map names
+ map_matrix.append(copy.copy(map_name_list))
+
+
+ # Needed for map registration
+ map_list = []
+
+ if len(map_matrix) > 0:
+
+ grass.message(_("Start r.mapcalc computation"))
+
+ count = 0
+ # Get the number of samples
+ num = len(map_matrix[0])
+
+ # Parallel processing
+ proc_list = []
+ proc_count = 0
+
+ # For all samples
+ for i in range(num):
+
+ count += 1
+ grass.percent(count, num, 1)
+
+ # Create the r.mapcalc statement for the current time step
+ map_name = "%s_%i" % (base, count)
+ expr = "%s = %s" % (map_name, expression)
+
+ # Check that all maps are in the sample
+ valid_maps = True
+ # Replace all dataset names with their map names of the current time step
+ for j in range(len(map_matrix)):
+ if map_matrix[j][i] == None:
+ valid_maps = False
+ break
+ # Substitute the dataset name with the map name
+ expr = expr.replace(id_list[j], map_matrix[j][i])
+
+ # Proceed with the next sample
+ if valid_maps == False:
+ continue
+
+ # Create the new map id and check if the map is already in the database
+ map_id = map_name + "@" + mapset
+
+ new_map = first_input.get_new_map_instance(map_id)
+
+ # Check if new map is in the temporal database
+ if new_map.is_in_db(dbif):
+ if grass.overwrite() == True:
+ # Remove the existing temporal database entry
+ new_map.delete(dbif)
+ new_map = first_input.get_new_map_instance(map_id)
+ else:
+ grass.error(_("Raster map <%s> is already in temporal database, use overwrite flag to overwrite"))
+ continue
+
+ # Set the time stamp
+ if sample_map_list[i].is_time_absolute():
+ start, end, tz = sample_map_list[i].get_absolute_time()
+ new_map.set_absolute_time(start, end, tz)
+ else:
+ start, end = sample_map_list[i].get_relative_time()
+ new_map.set_relative_time(start, end)
+
+ map_list.append(new_map)
+
+ # Start the parallel r.mapcalc computation
+ grass.verbose(_("Apply r.mapcalc expression: \"%s\"") % expr)
+
+ proc_list.append(Process(target=run_mapcalc, args=(expr,)))
+ proc_list[proc_count].start()
+ proc_count += 1
+
+ if proc_count == nprocs:
+ proc_count = 0
+ exitcodes = 0
+ for proc in proc_list:
+ proc.join()
+ exitcodes += proc.exitcode
+
+ if exitcodes != 0:
+ dbif.close()
+ grass.fatal(_("Error while r.mapcalc computation"))
+
+ # Empty process list
+ proc_list = []
+
+ # Register the new maps in the output space time dataset
+ grass.message(_("Start map registration in temporal database"))
+
+ # Overwrite an existing dataset if requested
+ if new_sp.is_in_db(dbif):
+ if grass.overwrite() == True:
+ new_sp.delete(dbif)
+ new_sp = tgis.space_time_raster_dataset(out_id)
+
+ # Copy the ids from the first input
+ temporal_type, semantic_type, title, description = first_input.get_initial_values()
+ new_sp.set_initial_values(temporal_type, semantic_type, title, description)
+ # Insert the dataset in the temporal database
+ new_sp.insert(dbif)
+
+ count = 0
+
+ for new_map in map_list:
+
+ count += 1
+ grass.percent(count, num, 1)
+
+ # Read the raster map data
+ new_map.load()
+
+ # In case of a null map continue, do not register null maps
+ if new_map.metadata.get_min() == None and new_map.metadata.get_max() == None:
+ if not register_null:
+ continue
+
+ # Insert map in temporal database
+ new_map.insert(dbif)
+
+ new_sp.register_map(new_map, dbif)
+
+ # Update the spatio-temporal extent and the raster metadata table entries
+ new_sp.update_from_registered_maps(dbif)
+
+ grass.percent(1, 1, 1)
+
+ dbif.close()
+
+###############################################################################
+
+def run_mapcalc(expr):
+ """Helper function to run r.mapcalc in parallel"""
+ return grass.run_command("r.mapcalc", expression=expr, overwrite=grass.overwrite(), quiet=True)
+
+###############################################################################
+
+if __name__ == "__main__":
+ options, flags = grass.parser()
+ main()
+
Property changes on: grass/trunk/temporal/tr.mapcalc/tr.mapcalc.py
___________________________________________________________________
Added: svn:executable
+ *
Modified: grass/trunk/temporal/tv.what.strds/tv.what.strds.py
===================================================================
--- grass/trunk/temporal/tv.what.strds/tv.what.strds.py 2012-03-29 13:56:23 UTC (rev 51181)
+++ grass/trunk/temporal/tv.what.strds/tv.what.strds.py 2012-03-29 13:57:41 UTC (rev 51182)
@@ -118,7 +118,7 @@
if not rows:
dbif.close()
- grass.fatal(_("Space time vector dataset <%s> is empty") % sg.get_id())
+ grass.fatal(_("Space time vector dataset <%s> is empty") % sp.get_id())
# Sample the raster dataset with the vector dataset and run v.what.rast
for row in rows:
More information about the grass-commit
mailing list