[GRASS-SVN] r33905 - grass/branches/develbranch_6/raster/r.series
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 16 07:12:10 EDT 2008
Author: neteler
Date: 2008-10-16 07:12:10 -0400 (Thu, 16 Oct 2008)
New Revision: 33905
Modified:
grass/branches/develbranch_6/raster/r.series/description.html
grass/branches/develbranch_6/raster/r.series/main.c
Log:
glynn: Add range= option (merge fom trunk, r33886)
Modified: grass/branches/develbranch_6/raster/r.series/description.html
===================================================================
--- grass/branches/develbranch_6/raster/r.series/description.html 2008-10-16 11:11:29 UTC (rev 33904)
+++ grass/branches/develbranch_6/raster/r.series/description.html 2008-10-16 11:12:10 UTC (rev 33905)
@@ -40,9 +40,16 @@
number of the raster map that holds the minimum/maximum value of the
time-series. The numbering starts at <em>0</em> up to <em>n</em> for the
first and the last raster listed in <em>input=</em>, respectively.
+<p>
+If the <em>range=</em> option is given, any values which fall outside
+that range will be treated as if they were NULL.
+The <em>range</em> parameter can be set to <em>low,high</em> thresholds:
+values outside of this range are treated as NULL (i.e., they will be
+ignored by most aggregates, or will cause the result to be NULL if -n is given).
+The <em>low,high</em> thresholds are floating point, so use <em>-inf</em> or
+<em>inf</em> for a single threshold (e.g., <em>range=0,inf</em> to ignore
+negative values, or <em>range=-inf,-200.4</em> to ignore values above -200.4).
-
-
<h2>EXAMPLES</h2>
Using <em>r.series</em> with wildcards:
Modified: grass/branches/develbranch_6/raster/r.series/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.series/main.c 2008-10-16 11:11:29 UTC (rev 33904)
+++ grass/branches/develbranch_6/raster/r.series/main.c 2008-10-16 11:12:10 UTC (rev 33905)
@@ -104,7 +104,7 @@
struct GModule *module;
struct
{
- struct Option *input, *output, *method;
+ struct Option *input, *output, *method, *range;
} parm;
struct
{
@@ -121,6 +121,7 @@
DCELL *values, *values_tmp;
int nrows, ncols;
int row, col;
+ double lo, hi;
G_gisinit(argv[0]);
@@ -149,6 +150,12 @@
flag.quiet->key = 'q';
flag.quiet->description = _("Run quietly");
+ parm.range = G_define_option();
+ parm.range->key = "range";
+ parm.range->type = TYPE_DOUBLE;
+ parm.range->key_desc = "lo,hi";
+ parm.range->description = _("Ignore values outside this range");
+
flag.nulls = G_define_flag();
flag.nulls->key = 'n';
flag.nulls->description = _("Propagate NULLs");
@@ -163,6 +170,11 @@
"in future. Please use '--quiet' instead."));
}
+ if (parm.range->answer) {
+ lo = atof(parm.range->answers[0]);
+ hi = atof(parm.range->answers[1]);
+ }
+
/* process the input maps */
for (i = 0; parm.input->answers[i]; i++) ;
num_inputs = i;
@@ -237,6 +249,10 @@
if (G_is_d_null_value(&v))
null = 1;
+ else if (parm.range->answer && (v < lo || v > hi)) {
+ G_set_d_null_value(&v, 1);
+ null = 1;
+ }
values[i] = v;
}
More information about the grass-commit
mailing list