[GRASS-dev] r.series threshold patch

Glynn Clements glynn at gclements.plus.com
Fri Aug 17 17:51:53 EDT 2007


Markus Neteler wrote:

> >> to easier operate on incomplete time series from MODIS (and
> >> others), we would like to suggest attached patch. It
> >> adds a threshold to filter out incomplete pixel series
> >> before calling the aggregation function which saves us
> >> to perform extra runs on counting valid pixels and to
> >> post-filter the aggregated results.
> >
> > While I don't doubt that this is a useful optimisation for your
> > particular case, I'm generally opposed to adding such optimisations
> > for specific cases.
> >
> > A more general optimisation would be to extend the method= and output=
> > options to accept multiple values, so that you can compute multiple
> > aggregates in a single run. You would still need to combine the two
> > outputs with e.g. r.mapcalc, but you would only need one run of
> > r.series.
> >   
> The optimization you propose is of course far more general than what
> we did, and could be extremely valuable.
> 
> Nonetheless, we think that introducing the threshold parameter is not
> really a special case hack: all it really does is a straightforward
> generalization of the current -n flag, transforming it from a ON/OFF
> switch to an integer value.
> 
> The threshold parameter indicates the minimum number of non NULL
> inputs required for passing over the inputs to the aggregation
> function.
> 
> It varies in the range [1,num_inputs]; thresh=num_inputs is equivalent
> to -n (return NULL unless the inputs are all non NULL), while thresh=1
> is the standard behaviour (compute the aggregation if there is at
> least 1 non NULL input).

Actually, thresh=0 would give the existing behaviour. If -n isn't
used, the values are always passed to the aggregate function. If all
of the values are null, most aggregates will return null, but the
"count" aggregate will return 0.

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




More information about the grass-dev mailing list