[GRASS-user] r.le.setup trouble

Hamish hamish_nospam at yahoo.com
Mon Dec 11 06:11:47 EST 2006


Koen Hufkens wrote:
> I have some trouble with the r.le.setup module, maybe someone knows
> the solution to this.
> 
> When I run r.le.setup to define my moving window specification to use
> in further r.le analysis the module stalls when I'm being asked to
> specify the size of my (rectangular) moving window. If I do so, let's
> say a 3 by 3 window, it complains about a 0 being present while I
> didn't type any zeros.
> 
> The full output of the procedure I followed is listed below:
> 
>  HOW WILL YOU SPECIFY THE MOVING WINDOW?
> 
>        Use keyboard to enter moving window dimensions   1
>        Use mouse to draw moving window                  2
> 
>                                             Which Number?  1
> 
>     If a MASK is not present (see r.mask) a beep may sound
>     and a WARNING may be printed that can be ignored.
>     If a MASK is present there will be no warning.
> WARNING: unable to open raster map [MASK in PERMANENT]
> 
> 
>     Do you want to sample using rectangles
>        (including squares) (y) or circles (n)?   (y/n) [y]  
> 
>     Enter number of COLUMNS & ROWS for the dimensions of
>        the moving window (e.g., 10 10):  3 3 
> 
>     You entered a dimension as 0; enter dimensions again
> 
> ---
> 
> Entering other delimiters other than space didn't work either.
> 
> Any clues why I can't define ar rectangular moving window. I tried a
> circular one and that did work?

What version of GRASS? There were substantial fixes for r.le.setup right
before GRASS 6.2.0 was released. If 6.3-cvs, check out r.li too.


The above works fine for me using the spearfish dataset. Space as the
delim between "3 3". Draws the box, then moves on to the next question.


here is the relevant code from r.le.setup/mv_wind.c

...
			/* if sampling using rectangles/squares */

        else {
back:
           fprintf(stderr, "\n    Enter number of COLUMNS & ROWS for the dimensions of");
           fprintf(stderr, "\n       the moving window (e.g., 10 10):  ");

           numtrap(2, tmp);
           u_w = fabs(tmp[0]);
           u_l = fabs(tmp[1]);
           u_w0 = fabs(tmp[0])/mx[0];
           u_l0 = fabs(tmp[1])/mx[1];

				/* trap possible errors in dimensions */

           if (!u_w0 || !u_l0) {
              fprintf(stderr, "\n    You entered a dimension as 0; enter dimensions again\n");

              goto back;
           }



numtrap() is at the end of r.le.setup/sample.c.



Hamish




More information about the grass-user mailing list