[GRASS-dev] r.le--after some fixes still needs work
Hamish
hamish_nospam at yahoo.com
Sun Oct 1 04:21:25 EDT 2006
William wrote:
> Hamish, as to r.le.setup, at the CHOOSE THE SETUP OPTION step, I choose
> Setup sampling units, then Use keyboard to enter sampling unit
> dimensions, then 1 for for How many different SCALES, then 1 for Random
> nonoverlapping, then "y" for Do you want to sample using rectangles,
> then "1.0" for Sampling unit SHAPE, then 144 for Recommended maximum
> SIZE followed by "y" it's OK, then 20
> sampling units. At that point, the program should draw the sampling
> units in red on the monitor, but nothing is displayed. Not sure where
> the communication problem is...
[...]
William L. Baker wrote:
> Remaining problem just in r.le.setup. All of r.le.setup seems to work
> except Setup sampling units.
>
> When setting up sampling units, you are right the problem is likely in
> calc_unit_loc in filling the uy array, which holds the y values for
> displaying the units on the screen. I have looked through that code
> and don't see anything obvious that is wrong, so I will have to insert
> some print statements and see what is going on. Other displays of
> sampling areas on screen work fine (e.g., in setup for moving window).
> Seems strange, since this worked fine under GRASS 5.X and I can't see
> what might have changed to affect this. Will work more on this in next
> few days, I hope.
Hi, I had another look. in sample.c, mx[0], and mx[1] are not getting
passed correctly to the calc_unit_loc() fn.
this change makes it get a little further: (taken from the fn)
Index: setup.h
===================================================================
RCS file: /home/grass/grassrepository/grass6/raster/r.le/r.le.setup/setup.h,v
retrieving revision 2.1
diff -u -r2.1 setup.h
--- setup.h 9 Feb 2006 03:09:01 -0000 2.1
+++ setup.h 1 Oct 2006 08:10:46 -0000
@@ -78,7 +78,9 @@
void sample();
void man_unit();
void draw_grid();
-int calc_unit_loc();
+int calc_unit_loc(double, int, int, int, int, double, int, int, int,
+ double, int, int, int, double *, double *, int *,
+ double, int, int, double, double, double);
void get_rd();
void f();
int overlap();
these warnings are then given:
sample.c: In function `man_unit':
sample.c:564: warning: passing arg 14 of `calc_unit_loc' from incompatible pointer type
sample.c:564: warning: passing arg 15 of `calc_unit_loc' from incompatible pointer type
(that's ux and uy)
as it is called:
/* calculate the upper left corner of sampling
units and store them in arrays ux and uy */
if (!calc_unit_loc(radius, t, b, l, r, ratio, u_w, u_l, method, intv, num, h_d,
v_d, ux, uy, &sites, (int)(start[1]), (int)(start[0]), fmask, nx,
mx[0], mx[1]))
goto last;
and as defined in the fn:
/* CALCULATE THE COORDINATES OF THE TOP LEFT CORNER OF THE SAMPLING UNITS */
int calc_unit_loc (double radius, int top, int bot, int left, int right,
double ratio, int u_w, int u_l, int method, double intv,
int num, int h_d, int v_d, double *ux, double *uy,
int *sites, double startx, int starty, int fmask,
double nx, double x, double y)
{
Then, after the random quadrat boxes draw correctly, if you hit [y] you
still get a segfault, but again, one bug at a time.
Hamish
More information about the grass-dev
mailing list