Wed, Jan 4 2006
19:47:06
|
|
Request created by guest
|
|
Subject: r.watershed: fix NULL support
Platform: GNU/Linux/i386
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: 2005.11.16
r.watershed still puts 0 where it should put NULL (in the streams
and basins output maps)
Maciek |
|
Wed, Jul 26 2006
18:12:02
|
|
User changed to tutey@o2.pl by msieczka
|
|
Thu, Nov 9 2006
07:15:52
|
|
Area changed to wish6 by hbowman
|
|
Thu, Nov 9 2006
07:16:24
|
|
Subject changed to r.watershed: 0's should be NULL for non-basins,streams by hbowman
|
|
Thu, Nov 9 2006
07:16:41
|
|
Priority changed to 60 by hbowman
|
|
Thu, Nov 9 2006
07:16:49
|
|
Priority changed to 40 by hbowman
|
|
Thu, Nov 9 2006
07:17:52
|
|
Comments added by hbowman
|
|
work around:
r.null rwater.basins setnull=0
Hamish
|
|
Thu, Nov 9 2006
07:18:21
|
|
Subject changed to r.watershed: 0's should be NULL for basins,streams by hbowman
|
|
Thu, Nov 9 2006
07:44:05
|
|
Comments added by hbowman
|
|
Cc: grass-dev@grass.itc.it
[r.watershed: 0's should be NULL for basins,half.basins,streams]
this could be done in ram/close_maps2.c:
/* basins map */
if (bas_flag) {
map_fd = G_open_cell_new(bas_name);
for (r=0; r<nrows; r++) {
for (c=0; c<ncols; c++) {
cellrow[c] = bas[SEG_INDEX(bas_seg, r, c)];
}
G_put_raster_row(map_fd, cellrow, CELL_TYPE);
}
G_close_cell(map_fd);
G_write_colors(bas_name, this_mapset, &colors);
}
with a test for zero in the for(c=0; c<ncols; c++) loop.
Usually it would be better to put the setting to NULL in the fn that populates
the "bas" array, but AFAIC grasp the data is stored in memory in such a way
that this doesn't make sense -- only cells with real data are stored in memory.
???
for streams map (apparently seg_flag in close_maps2.c), this would be
something like
for (c=0; c<ncols; c++) {
value = FLAG_GET(swale, r, c);
if (value)
cellrow[c] = bas[SEG_INDEX(bas_seg, r, c)];
- else cellrow[c] = 0;
+ else G_set_c_null_value(cellrow+c, 1); // ??????
}
G_put_raster_row(map_fd, cellrow, CELL_TYPE);
...
or start each new row by init'ing it to all NULL:
G_set_c_null_value(cellrow, ncols);
and then remove the else/*if(value)*/.
I don't know which is more efficient.
??
Hamish
|
|
Mon, Nov 13 2006
10:50:12
|
|
Comments added by hbowman
|
|
done for stream maps.
basins, half.basins maps are done for RAM mode bug not SEG mode.
(I couldn't see where to do that)
Hamish
|
|
Mon, Nov 13 2006
10:50:47
|
|
Subject changed to r.watershed: 0's should be NULL for basins in seg mode by hbowman
|
|