<div dir="ltr"><br><br>On Tue, Nov 20, 2018 at 7:59 PM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<br>><br>><br>> On 11/19/18 12:41 PM, Markus Neteler wrote:<br>> > On Sun, Nov 18, 2018 at 10:32 PM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<br>> >> I am preparing a correlation matrix for 7 raster layers. The results using the r.covar module are different from the R layerStats function. I suspect this is due to handling of null cells. The R function has a parameter to remove NA cells, but the GRASS module, I think, just loops over all cells, including no value.<br>> >><br>> >><br>> >> Can anyone confirm that GRASS does not deal with null cells, and that this would cause the difference in correlation results?<br>> > Here how r.covar treats NULL cells:<br>> ><br>> > <a href="https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.covar/main.c#L93">https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.covar/main.c#L93</a><br>><br>> Looking at lines 94 - 100, it seems that the count variable is<br>> incremented even when a cell value is null.<br><div><br></div><div>because of the "continue;", count is not incremented if any cell value is null</div><div><br></div><div>Markus M</div><div><br></div><div>></div>> Please correct me if I'm wrong.<br>><br>> Since count is used in the calculation of covariance and correlation<br>> (lines 118-132) shouldn't it contain the number only of cells with value?<br>><br>><br>> Thanks<br>><br>> ><br>> > Markus<br>><br>> --<br>> Micha Silver<br>> Ben Gurion Univ.<br>> Sde Boker, Remote Sensing Lab<br>> cell: +972-523-665918<br>><br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a></div>