[GRASS-dev] r.series thresholds?

Glynn Clements glynn at gclements.plus.com
Wed Oct 13 08:18:12 EDT 2010


Hamish wrote:

> > > Is threshold= not even related to the method=threshold
> > > option?!
> 
> (yes, this was written after looking at the source code, but even
> now I'm still not fully understanding all of it: multiple=yes?)

output=, method= and quantile= (and the now-removed threshold=) all
accept multiple answers, allowing multiple aggregates to be computed
in a single run, e.g.:

	r.series input=map1,...,mapN \
		output=map.mean,map.stddev \
		method=average,stddev
or:
	r.series input=map1,...,mapN \
		output=map.p10,map.p50,map.p90 \
		method=quantile,quantile,quantile \
		quantile=0.1,0.5,0.9

The same number of values must be provided for all options.

If multiple outputs were commonplace, it might be better to merge
these options, i.e.:

	r.series input=map1,...,mapN \
		output=map.p10,quantile,0.1,map.p50,quantile,0.5,map.p90,quantile,0.9

or even:

	r.series input=map1,...,mapN \
		output=map.p10=quantile(0.1),map.p50=quantile(0.5),map.p90=quantile(0.9)

OTOH, this loses the abilibity to make use of the validation in
G_parser() and type-specific input mechanisms in the GUI. And the
existing interface is more appropriate when you only have one output,
which is probably more common.

> > Ugh. Thanks for bringing this up. r.series was broken with
> > r41667; quantile= no longer works.
> > 
> > Reverted with r43853.
> > 
> > threshold= an method=threshold no longer exist, so this
> > question is moot.
> 
> Not quite moot, it had already been backported to 6.5svn and
> in the last month 6.4.1svn as well & so still exists there and
> more to be discussed, decided, and resolved before we can move
> on.

With the introduction of quantile=, the interface to the aggregate
functions was changed so that each function accepts a "closure"
argument. This allows e.g. c_quant() to calculate arbitrary quantiles
rather than needing a separate function for each (fixed) quantile.

But the body of r.series is generic, i.e. the code is the same
regardless of the method(s) used. So it would always pass the
quantile= value to the aggregate, but only c_quant() would pay any
attention to it.

r41667 stomped on this, ignoring the quantile= values and always
passing the threshold= values instead.

Appropriate solutions include:

1. Adding specific code which passes the correct value based upon the
method, or

2. Merging quantile= and threshold= into a generic parameter= option
(but this loses the 0.0-1.0 validity check for quantile values).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list