G. Allegri | 20 Jun 2012 12:17
Picon
Gravatar

adding a flag to discard NULL values in mapalgebra aggregation functions

Following a thread I've opened on the grass-users list, I would like to suggest a proposal to add a flag, to the r.mapcalc command, to discrd  NULL values when evaluating aggregation functions like max(), min(), mode(), etc.

Looking into the code of, for example., the max() function [1], it seems that if a NULL value is in the set of the arguments, the result is set to NULL (if I understand it correctly).
With the proposed flag, I would like to ask r.mapcalc to do not consider the NULLs, and to the calculations only on the not-NULL subset of values.
This would let us do filtering (with row/columns offsets) as it is done in r.neighbors, where the NULL values are directly discarded.

giovanni

_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Margherita Di Leo | 20 Jun 2012 12:20
Picon
Gravatar

Re: adding a flag to discard NULL values in mapalgebra aggregation functions

Hi Giovanni, all,

On Wed, Jun 20, 2012 at 12:17 PM, G. Allegri <giohappy <at> gmail.com> wrote:
Following a thread I've opened on the grass-users list, I would like to suggest a proposal to add a flag, to the r.mapcalc command, to discrd  NULL values when evaluating aggregation functions like max(), min(), mode(), etc.
Looking into the code of, for example., the max() function [1], it seems that if a NULL value is in the set of the arguments, the result is set to NULL (if I understand it correctly).
With the proposed flag, I would like to ask r.mapcalc to do not consider the NULLs, and to the calculations only on the not-NULL subset of values.

Shouldn't it be the default behavior?

ciao madi

 
This would let us do filtering (with row/columns offsets) as it is done in r.neighbors, where the NULL values are directly discarded.

giovanni


_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev



--
Dr. Margherita Di Leo



_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
G. Allegri | 20 Jun 2012 12:24
Picon
Gravatar

Re: adding a flag to discard NULL values in mapalgebra aggregation functions

Shouldn't it be the default behavior?

I supposed it too, but it isn't ;)

giovanni
 

ciao madi

 
This would let us do filtering (with row/columns offsets) as it is done in r.neighbors, where the NULL values are directly discarded.

giovanni


_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev



--
Dr. Margherita Di Leo




_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
Glynn Clements | 21 Jun 2012 11:25

Re: adding a flag to discard NULL values in mapalgebra aggregation functions


G. Allegri wrote:

> Following a thread I've opened on the grass-users list, I would like to
> suggest a proposal to add a flag, to the r.mapcalc command, to discrd
> NULL values when evaluating aggregation functions like max(), min(),
> mode(), etc.
> Looking into the code of, for example., the max() function [1], it seems
> that if a NULL value is in the set of the arguments, the result is set to
> NULL (if I understand it correctly).
> With the proposed flag, I would like to ask r.mapcalc to do not consider
> the NULLs, and to the calculations only on the not-NULL subset of values.
> This would let us do filtering (with row/columns offsets) as it is done in
> r.neighbors, where the NULL values are directly discarded.

In 7.0, I've added nmin, nmax, nmedian and nmode functions which
ignore nulls.

--

-- 
Glynn Clements <glynn <at> gclements.plus.com>
G. Allegri | 21 Jun 2012 11:30
Picon
Gravatar

Re: adding a flag to discard NULL values in mapalgebra aggregation functions

In 7.0, I've added nmin, nmax, nmedian and nmode functions which
ignore nulls.

Great Glynn!
Thanks.

giovannni

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

_______________________________________________
grass-dev mailing list
grass-dev <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Gmane