[GRASS-SVN] r51143 - in grass/trunk: raster/r.gwflow
temporal/t.sample temporal/tr.series temporal/tr.univar
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 22 08:24:32 EDT 2012
Author: huhabla
Date: 2012-03-22 05:24:32 -0700 (Thu, 22 Mar 2012)
New Revision: 51143
Modified:
grass/trunk/raster/r.gwflow/main.c
grass/trunk/temporal/t.sample/t.sample.py
grass/trunk/temporal/t.sample/test.t.sample.sh
grass/trunk/temporal/tr.series/tr.series.py
grass/trunk/temporal/tr.univar/tr.univar.py
Log:
Enabled spatio-temporal sampling
Modified: grass/trunk/raster/r.gwflow/main.c
===================================================================
--- grass/trunk/raster/r.gwflow/main.c 2012-03-22 12:21:11 UTC (rev 51142)
+++ grass/trunk/raster/r.gwflow/main.c 2012-03-22 12:24:32 UTC (rev 51143)
@@ -328,7 +328,7 @@
N_convert_array_2d_null_to_zero(data->r);
}
- /*Sources or sinks areoptional */
+ /*Sources or sinks are optional */
if (param.q->answer) {
N_read_rast_to_array_2d(param.q->answer, data->q);
N_convert_array_2d_null_to_zero(data->q);
@@ -357,13 +357,11 @@
N_convert_array_2d_null_to_zero(data->phead);
/****************************************************/
- /*explicite calculation of free groundwater surface */
-
+ /*explicite calculation of free groundwater surface */
/****************************************************/
if (data->gwtype == N_GW_UNCONFINED) {
/* allocate memory and copy the result into a new temporal vector */
- if (!(tmp_vect = (double *)calloc(les->rows, sizeof(double))))
- G_fatal_error(_("Out of memory"));
+ tmp_vect = (double *)G_calloc(les->rows, sizeof(double));
/*copy data */
for (i = 0; i < les->rows; i++)
@@ -428,7 +426,7 @@
N_write_array_2d_to_rast(budget, param.budget->answer);
}
- /*Compute the the velocity field if required and write the result into three rast maps */
+ /*Compute the the velocity field if required and write the result into two raster maps */
if (param.vector_x->answer && param.vector_y->answer) {
field =
N_compute_gradient_field_2d(data->phead, data->hc_x, data->hc_y,
Modified: grass/trunk/temporal/t.sample/t.sample.py
===================================================================
--- grass/trunk/temporal/t.sample/t.sample.py 2012-03-22 12:21:11 UTC (rev 51142)
+++ grass/trunk/temporal/t.sample/t.sample.py 2012-03-22 12:24:32 UTC (rev 51143)
@@ -5,7 +5,7 @@
# MODULE: t.sample
# AUTHOR(S): Soeren Gebbert
#
-# PURPOSE: Sample the input space time dataset with a sample space time dataset and print the result to stdout
+# PURPOSE: Sample the input space time dataset(s) with a sample space time dataset and print the result to stdout
# COPYRIGHT: (C) 2011 by the GRASS Development Team
#
# This program is free software under the GNU General Public
@@ -15,12 +15,12 @@
#############################################################################
#%module
-#% description: Sample the input space time dataset with a sample space time dataset and print the result to stdout
+#% description: Sample the input space time dataset(s) with a sample space time dataset and print the result to stdout
#% keywords: temporal
#% keywords: sample
#%end
-#%option G_OPT_STDS_INPUT
+#%option G_OPT_STDS_INPUTS
#%end
#%option G_OPT_STDS_INPUT
@@ -50,10 +50,16 @@
#%end
#%flag
-#% key: h
+#% key: c
#% description: Print column names
#%end
+#%flag
+#% key: s
+#% description: Check spatial overlap to perform spatio-temporal sampling
+#%end
+
+
import grass.script as grass
import grass.temporal as tgis
@@ -62,20 +68,21 @@
def main():
# Get the options
- input = options["input"]
+ inputs = options["inputs"]
sampler = options["sample"]
samtype = options["samtype"]
intype = options["intype"]
separator = options["fs"]
method = options["method"]
- header = flags["h"]
+ header = flags["c"]
+ spatial = flags["s"]
method = method.split(",")
# Make sure the temporal database exists
tgis.create_temporal_database()
- tgis.sample_stds_by_stds_topology(intype, samtype, input, sampler, header, separator, method)
+ tgis.sample_stds_by_stds_topology(intype, samtype, inputs, sampler, header, separator, method, spatial)
if __name__ == "__main__":
options, flags = grass.parser()
Modified: grass/trunk/temporal/t.sample/test.t.sample.sh
===================================================================
--- grass/trunk/temporal/t.sample/test.t.sample.sh 2012-03-22 12:21:11 UTC (rev 51142)
+++ grass/trunk/temporal/t.sample/test.t.sample.sh 2012-03-22 12:24:32 UTC (rev 51143)
@@ -63,18 +63,18 @@
tv.list pnts_abs1 -h
# The @test
-t.sample method=equal input=precip_abs0 samtype=stvds sample=pnts_abs0 -h
-t.sample method=during input=precip_abs0 samtype=stvds sample=pnts_abs0 -h
-t.sample method=overlap input=precip_abs0 samtype=stvds sample=pnts_abs0 -h
-t.sample method=contain input=precip_abs0 samtype=stvds sample=pnts_abs0 -h
-t.sample input=precip_abs0 samtype=strds sample=precip_abs0 -h
+t.sample method=equal input=precip_abs0,precip_abs0,precip_abs0,precip_abs0 samtype=stvds sample=pnts_abs0 -cs
+t.sample method=during input=precip_abs0,precip_abs0,precip_abs0 samtype=stvds sample=pnts_abs0 -c
+t.sample method=overlap input=precip_abs0,precip_abs0 samtype=stvds sample=pnts_abs0 -cs
+t.sample method=contain input=precip_abs0 samtype=stvds sample=pnts_abs0 -c
+t.sample input=precip_abs0 samtype=strds sample=precip_abs0 -cs
# Test with temporal point data
t.register type=rast input=precip_abs0 file="${n1}" start="2001-01-01" increment="1 months"
tr.list precip_abs0 -h
-t.sample input=precip_abs0 samtype=stvds sample=pnts_abs0 -h
-t.sample input=precip_abs0 samtype=stvds sample=pnts_abs1 -h
+t.sample input=precip_abs0 samtype=stvds sample=pnts_abs0 -cs
+t.sample input=precip_abs0 samtype=stvds sample=pnts_abs1 -cs
t.unregister type=rast maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6
t.remove type=strds input=precip_abs0
Modified: grass/trunk/temporal/tr.series/tr.series.py
===================================================================
--- grass/trunk/temporal/tr.series/tr.series.py 2012-03-22 12:21:11 UTC (rev 51142)
+++ grass/trunk/temporal/tr.series/tr.series.py 2012-03-22 12:24:32 UTC (rev 51143)
@@ -5,7 +5,7 @@
# MODULE: tr.series
# AUTHOR(S): Soeren Gebbert
#
-# PURPOSE: Performe different aggregation algorithms from r.series on all or a selected subset of raster maps in a space time raster dataset
+# PURPOSE: Perform different aggregation algorithms from r.series on all or a selected subset of raster maps in a space time raster dataset
# COPYRIGHT: (C) 2011 by the GRASS Development Team
#
# This program is free software under the GNU General Public
@@ -15,7 +15,7 @@
#############################################################################
#%module
-#% description: Performe different aggregation algorithms from r.series on all or a subset of raster maps in a space time raster dataset
+#% description: Perform different aggregation algorithms from r.series on all or a subset of raster maps in a space time raster dataset
#% keywords: temporal
#% keywords: series
#%end
Modified: grass/trunk/temporal/tr.univar/tr.univar.py
===================================================================
--- grass/trunk/temporal/tr.univar/tr.univar.py 2012-03-22 12:21:11 UTC (rev 51142)
+++ grass/trunk/temporal/tr.univar/tr.univar.py 2012-03-22 12:24:32 UTC (rev 51143)
@@ -5,7 +5,7 @@
# MODULE: tr.univar
# AUTHOR(S): Soeren Gebbert
#
-# PURPOSE: Calculates univariate statistics from the non-null cells of a space time raster dataset
+# PURPOSE: Calculates univariate statistics from the non-null cells for each registered raster map of a space time raster dataset
# COPYRIGHT: (C) 2011 by the GRASS Development Team
#
# This program is free software under the GNU General Public
@@ -15,7 +15,7 @@
#############################################################################
#%module
-#% description: Calculates univariate statistics from the non-null cells for each registred raster map of a space time raster dataset
+#% description: Calculates univariate statistics from the non-null cells for each registered raster map of a space time raster dataset
#% keywords: spacetime raster dataset
#% keywords: raster
#% keywords: statistics
@@ -74,7 +74,7 @@
sp = tgis.space_time_raster_dataset(id)
- if sp.is_in_db() == False:
+ if sp.is_in_db(dbif) == False:
dbif.close()
grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
More information about the grass-commit
mailing list