[GRASS5] r.texture segfault

Markus Neteler neteler at itc.it
Tue Jul 12 03:27:38 EDT 2005


On Sat, Jul 09, 2005 at 10:00:51PM +0100, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > > > >    if (grays[row][col] < 0 || grays[row][col] > PGM_MAXMAXVAL)
> > > > >       G_fatal_error ("Too many categories (found: %i, max: %i). Try to
> > > > >       rescale or reclassify the map", grays[row][col], PGM_MAXMAXVAL);
> > > > 
> > > > 
> > > > The check is good, but the -2147483648 problem is still that the module
> > > > doesn't understand NULLs?
> > > 
> > > Correct.
> > > 
> > > > This stops the Segfault but the module still
> > > > doesn't work right. Or does the texture algorithm forbid NULLs?
> > > 
> > > Correct.
> > > 
> > > If your data has nulls, you have to get rid of them, e.g. using
> > > r.fillnulls. Ditto for out-of-range values (<0 or >255).
> > 
> > Excuse me, I don't understand your comment. Most of the raster
> > modules do handle NULL data cells. Can't we propagate also
> > in r.texture a NULL hole to the output map? It's clear that we
> > cannot calculate texture on NULL data, but we could write out
> > NULL at that position and move on for the rest of the map.
> 
> Yes, however:
> 
> 1. r.texture doesn't do this at present; someone needs to add code to
> do it.
> 
> 2. r.texture uses a neighbourhood window, so each null cell would
> result in a patch of nulls the same size as the window.
> 
> > ?
> > 
> > BTW, why is -2147483648 < 0  not true in the if condition?
> 
> From your previous message:
> 
> > ERROR: Too many categories (found: -2147483648, max: 255). Try to rescale
> 
> it appears that it is true (the error is printed if the condition is
> true).
> 

Ok. For now I have split the error message for the > 255 and the < 0 cases.

Markus




More information about the grass-dev mailing list