[GRASS-dev] [GRASS GIS] #3747: Allow appending instead of overwriting an output file in relevant statistics or attribute reporting modules
GRASS GIS
trac at osgeo.org
Mon Feb 4 22:05:46 PST 2019
#3747: Allow appending instead of overwriting an output file in relevant
statistics or attribute reporting modules
------------------------------+-------------------------
Reporter: Nikos Alexandris | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Default | Version: unspecified
Keywords: | CPU: Unspecified
Platform: Unspecified |
------------------------------+-------------------------
We frequently report statistics for multiple maps. It would be very useful
to allow appending to an existing file, instead of overwriting it, by
adding a flag/parameter to relevant modules such as
https://grass.osgeo.org/grass76/manuals/r.stats.html or even
https://grass.osgeo.org/grass76/manuals/r.univar.html.
(The latter, though, computes the overall statistics if many maps are
given as an input. Perhaps a flag could allow for a serial output of
statistics for each input raster map separately.)
Here a suggested example (verified that works) for `r.stats`, in the
context of this thread https://lists.osgeo.org/pipermail/grass-
dev/2018-August/089377.html:
{{{
Index: raster/r.stats/main.c
===================================================================
--- raster/r.stats/main.c (révision 72717)
+++ raster/r.stats/main.c (copie de travail)
@@ -223,7 +223,7 @@
name = option.output->answer;
if (name != NULL && strcmp(name, "-") != 0) {
- if (NULL == freopen(name, "w", stdout)) {
+ if (NULL == freopen(name, "a", stdout)) {
G_fatal_error(_("Unable to open file <%s> for writing"),
name);
}
}
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3747>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list