[GRASS-SVN] r46483 - grass/trunk/raster/r.watershed/ram
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 1 08:42:07 EDT 2011
Author: mmetz
Date: 2011-06-01 05:42:07 -0700 (Wed, 01 Jun 2011)
New Revision: 46483
Modified:
grass/trunk/raster/r.watershed/ram/init_vars.c
Log:
input overland flow can be DCELL
Modified: grass/trunk/raster/r.watershed/ram/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/init_vars.c 2011-06-01 06:31:05 UTC (rev 46482)
+++ grass/trunk/raster/r.watershed/ram/init_vars.c 2011-06-01 12:42:07 UTC (rev 46483)
@@ -11,7 +11,7 @@
{
int r, c;
CELL *buf, alt_value, asp_value, block_value;
- DCELL dvalue, wat_value;
+ DCELL dvalue, wat_value, *dbuf;
void *elebuf, *ptr;
int fd, ele_map_type;
size_t ele_size;
@@ -217,28 +217,30 @@
MASK_flag = 1;
/* read flow accumulation from input map flow: amount of overland flow per cell */
- buf = Rast_allocate_c_buf();
if (run_flag) {
+ dbuf = Rast_allocate_d_buf();
fd = Rast_open_old(run_name, "");
for (r = 0; r < nrows; r++) {
- Rast_get_c_row(fd, buf, r);
+ Rast_get_d_row(fd, dbuf, r);
for (c = 0; c < ncols; c++) {
if (MASK_flag) {
block_value = FLAG_GET(worked, r, c);
if (!block_value)
- wat[SEG_INDEX(wat_seg, r, c)] = buf[c];
+ wat[SEG_INDEX(wat_seg, r, c)] = dbuf[c];
else
wat[SEG_INDEX(wat_seg, r, c)] = 0.0;
}
else
- wat[SEG_INDEX(wat_seg, r, c)] = buf[c];
+ wat[SEG_INDEX(wat_seg, r, c)] = dbuf[c];
}
}
Rast_close(fd);
+ G_free(dbuf);
}
/* depression: drainage direction will be set to zero later */
if (pit_flag) {
+ buf = Rast_allocate_c_buf();
fd = Rast_open_old(pit_name, "");
for (r = 0; r < nrows; r++) {
Rast_get_c_row(fd, buf, r);
@@ -249,10 +251,12 @@
}
}
Rast_close(fd);
+ G_free(buf);
}
/* this is also creating streams... */
if (ob_flag) {
+ buf = Rast_allocate_c_buf();
fd = Rast_open_old(ob_name, "");
for (r = 0; r < nrows; r++) {
Rast_get_c_row(fd, buf, r);
@@ -263,8 +267,8 @@
}
}
Rast_close(fd);
+ G_free(buf);
}
- G_free(buf);
if (ril_flag)
ril_fd = Rast_open_old(ril_name, "");
More information about the grass-commit
mailing list