[GRASS-SVN] r38748 - in grass/trunk/raster: r.li/r.li.daemon
r.topmodel r.watershed/shed
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 16 04:03:15 EDT 2009
Author: hamish
Date: 2009-08-16 04:03:14 -0400 (Sun, 16 Aug 2009)
New Revision: 38748
Removed:
grass/trunk/raster/r.topmodel/REFERENCE
Modified:
grass/trunk/raster/r.li/r.li.daemon/worker.c
grass/trunk/raster/r.topmodel/misc.c
grass/trunk/raster/r.topmodel/r.topmodel.html
grass/trunk/raster/r.watershed/shed/com_line.c
Log:
merge some stuff from devbr6 related to #637,
r38729: improved warning message;
r38732, r38733: cleanup messages;
r38734: move REFERENCE into help page;
r38738: quote path for G_system(), use G_gisbase()
TODO: use G_spawn() instead of [G_]system()
Modified: grass/trunk/raster/r.li/r.li.daemon/worker.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/worker.c 2009-08-15 21:13:18 UTC (rev 38747)
+++ grass/trunk/raster/r.li/r.li.daemon/worker.c 2009-08-16 08:03:14 UTC (rev 38748)
@@ -135,7 +135,7 @@
ad->mask_name = mask_preprocessing(toReceive.f.f_ma.mask,
raster, ad->rl, ad->cl);
if (ad->mask_name == NULL) {
- G_message(_("CHILD[pid = %i]: unable to open %s mask ... continue without!!!"),
+ G_message(_("CHILD[pid = %i]: unable to open <%s> mask ... continuing without!"),
pid, toReceive.f.f_ma.mask);
ad->mask = -1;
}
@@ -145,14 +145,13 @@
erease_mask = 1;
ad->mask = open(ad->mask_name, O_WRONLY, 0755);
if (ad->mask == -1) {
- G_message(_("CHILD[pid = %i]: unable to open %s mask ... continue without!!!"),
+ G_message(_("CHILD[pid = %i]: unable to open <%s> mask ... continuing without!"),
pid, toReceive.f.f_ma.mask);
}
}
+ }
-
- }
/* memory menagement */
if (ad->rl > used) {
/* allocate cache */
@@ -228,6 +227,7 @@
double add_row, add_col;
buf = malloc(cl * sizeof(int));
+
/* open raster */
if (Rast_get_cellhd(raster, "", &cell) == -1)
return NULL;
@@ -238,10 +238,12 @@
add_row = 1.0 * oldcell.rows / rl;
add_col = 1.0 * oldcell.cols / cl;
+
tmp_file = G_tempfile();
mask_fd = open(tmp_file, O_RDWR | O_CREAT, 0755);
old_fd = Rast_open_old(mask, "");
old = Rast_allocate_c_buf();
+
for (i = 0; i < rl; i++) {
int riga;
Deleted: grass/trunk/raster/r.topmodel/REFERENCE
===================================================================
--- grass/trunk/raster/r.topmodel/REFERENCE 2009-08-15 21:13:18 UTC (rev 38747)
+++ grass/trunk/raster/r.topmodel/REFERENCE 2009-08-16 08:03:14 UTC (rev 38748)
@@ -1,5 +0,0 @@
-REFERENCES
-
-K. Beven, R. Lamb, P. Quinn, R. Romanowicz, and J. Freer. TOPMODEL, in V.P. Singh (Ed.). Computer Models of Watershed Hydrology. Water Resources Publications, 1995.
-
-S.C. Liaw, Streamflow simulation using a physically based hydrologic model in humid forested watersheds (Dissertation). Colorado State University, CO. p163, 1988.
Modified: grass/trunk/raster/r.topmodel/misc.c
===================================================================
--- grass/trunk/raster/r.topmodel/misc.c 2009-08-15 21:13:18 UTC (rev 38747)
+++ grass/trunk/raster/r.topmodel/misc.c 2009-08-16 08:03:14 UTC (rev 38748)
@@ -7,15 +7,14 @@
if (G_system(cmd)) {
- G_warning("Failed");
+ G_warning("Subprocess failed");
retval = 1;
}
else {
- G_message("OK");
+ G_verbose_message("Subprocess complete.");
retval = 0;
}
-
return retval;
}
@@ -25,7 +24,6 @@
char buf[GPATH_MAX];
char *hdmap;
-
hdmap = NULL;
if (!flg.input) {
hdmap = map.elev;
@@ -39,7 +37,7 @@
if (hdmap) {
sprintf(buf, "g.region rast=%s --quiet", hdmap);
- G_message("g.region rast=%s ... ", hdmap);
+ G_verbose_message("%s ...", buf);
if (run(buf))
exit(1);
@@ -50,17 +48,16 @@
void depressionless(void)
{
char buf[GPATH_MAX];
+
sprintf(buf, "r.fill.dir input=%s elev=%s dir=%s type=grass --quiet",
map.elev, map.fill, map.dir);
- G_message("r.fill.dir input=%s elev=%s dir=%s type=grass ... ",
- map.elev, map.fill, map.dir);
+ G_verbose_message("%s ...", buf);
if (run(buf))
exit(1);
map.elev = map.fill;
-
return;
}
@@ -68,15 +65,14 @@
void basin_elevation(void)
{
char buf[GPATH_MAX];
- sprintf(buf, "r.mapcalc expression='%s = if(%s == 0 || isnull(%s), null(), %s)' --quiet",
+
+ sprintf(buf, "r.mapcalc expression=\"%s = if(%s == 0 || isnull(%s), null(), %s)\" --quiet",
map.belev, map.basin, map.basin, map.elev);
- G_message("r.mapcalc '%s = if(%s == 0 || isnull(%s), null(), %s)'"
- " ... ", map.belev, map.basin, map.basin, map.elev);
+ G_verbose_message("%s ...", buf);
if (run(buf))
exit(1);
-
return;
}
@@ -87,23 +83,20 @@
if (map.belev) {
sprintf(buf, "r.topidx input=%s output=%s --quiet",
map.belev, map.topidx);
- G_message("r.topidx input=%s output=%s ... ", map.belev, map.topidx);
+ G_verbose_message("%s ...", buf);
if (run(buf))
exit(1);
}
if (map.topidx) {
- sprintf(buf, "r.stats -Anc "
- "input=%s nsteps=%d > %s",
+ sprintf(buf, "r.stats -Anc input=%s nsteps=%d output=\"%s\"",
map.topidx, misc.nidxclass, file.idxstats);
- G_message("r.stats -Anc input=%s nsteps=%d > %s ... ",
- map.topidx, misc.nidxclass, file.idxstats);
+ G_verbose_message("%s ...", buf);
if (run(buf))
exit(1);
}
-
return;
}
Modified: grass/trunk/raster/r.topmodel/r.topmodel.html
===================================================================
--- grass/trunk/raster/r.topmodel/r.topmodel.html 2009-08-15 21:13:18 UTC (rev 38747)
+++ grass/trunk/raster/r.topmodel/r.topmodel.html 2009-08-16 08:03:14 UTC (rev 38748)
@@ -39,13 +39,29 @@
</dd>
</dl>
+
+<h2>REFERENCES</h2>
+
+K. Beven, R. Lamb, P. Quinn, R. Romanowicz, and J. Freer.
+TOPMODEL, in V.P. Singh (Ed.). Computer Models of Watershed Hydrology.
+Water Resources Publications, 1995.
+<P>
+S.C. Liaw, Streamflow simulation using a physically based hydrologic
+model in humid forested watersheds (Dissertation).
+Colorado State University, CO. p163, 1988.
+
+
<h2>SEE ALSO</h2>
-<em><a href="r.fill.dir.html">r.fill.dir</a></em>,
-<em><a href="r.mapcalc.html">r.mapcalc</a></em>,
-<em><a href="r.topidx.html">r.topidx</a></em>,
-<em><a href="http://geni.ath.cx/r.topmodel.html">How to run r.topmodel</a></em>
+<a href="r.fill.dir.html">r.fill.dir</a>,
+<a href="r.mapcalc.html">r.mapcalc</a>,
+<a href="r.topidx.html">r.topidx</a></em>
+<br>
+<a href="http://geni.ath.cx/r.topmodel.html">How to run r.topmodel</a>
+
+
<h2>AUTHORS</h2>
+
Main algorithm sources are rewritten in C based on TMOD9502.FOR.
<br>
Thanks to Keith Beven.
@@ -53,4 +69,5 @@
GRASS port by <a href="mailto:grass4u at gmail com">Huidae Cho</a><br>
Hydro Laboratory, Kyungpook National University, South Korea
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>
Modified: grass/trunk/raster/r.watershed/shed/com_line.c
===================================================================
--- grass/trunk/raster/r.watershed/shed/com_line.c 2009-08-15 21:13:18 UTC (rev 38747)
+++ grass/trunk/raster/r.watershed/shed/com_line.c 2009-08-16 08:03:14 UTC (rev 38748)
@@ -4,7 +4,8 @@
#include "watershed.h"
#include "string.h"
-
+/* make sure any useful info is transfered to the man page before ripping out the interactive help messages */
+/* in addition there seem to be some useful user options here which are not currently available from the main parrser */
int com_line_Gwater(INPUT * input, OUTPUT * output)
{
struct Cell_head *window;
@@ -15,6 +16,7 @@
window = &(output->window);
if (0 == G_yes("Continue?", 1))
exit(EXIT_SUCCESS);
+
input->haf_name = (char *)G_calloc(40, sizeof(char));
input->accum_name = (char *)G_calloc(40, sizeof(char));
@@ -44,7 +46,7 @@
input->com_line_ram = (char *)G_calloc(400, sizeof(char));
prog_name = G_store(RAM_NAME);
sprintf(input->com_line_ram,
- "%s/etc/water/%s", G_getenv("GISBASE"), RAM_NAME);
+ "\"%s/etc/water/%s\"", G_gisbase(), RAM_NAME);
fprintf(stderr,
"\nIf there is not enough ram for the fast mode (%s) to run,\n",
RAM_NAME);
@@ -53,7 +55,7 @@
input->slow = 1;
input->com_line_seg = (char *)G_calloc(400, sizeof(char));
sprintf(input->com_line_seg,
- "%s/etc/water/%s", G_getenv("GISBASE"), SEG_NAME);
+ "\"%s/etc/water/%s\"", G_gisbase(), SEG_NAME);
}
}
else {
@@ -61,7 +63,7 @@
prog_name = G_store(SEG_NAME);
input->com_line_seg = (char *)G_calloc(400, sizeof(char));
sprintf(input->com_line_seg,
- "%s/etc/water/%s", G_getenv("GISBASE"), SEG_NAME);
+ "\"%s/etc/water/%s\"", G_gisbase(), SEG_NAME);
}
G_message(_("\nIf you hit <return> by itself for the next question, this"));
@@ -123,6 +125,7 @@
if (!i)
exit(EXIT_SUCCESS);
+
output->type_area = (char)i;
G_message(_("\nHow large an area (or how many overland flow units) must a drainage basin"));
More information about the grass-commit
mailing list