[GRASS-dev] g.mlist: output (to ASCII file) parameter wish

Hi,

since backticks are somewhat complicated to manage on some systems and
since the wxGUI command line actually "eats" them, it would be good to
have the possibility to output the result of g.mlist into an ASCII
file.

E.g. r.series accepts map lists from a file, so in a two-pass also
Windows users could easily process map series.

g.mlist rast pattern="precip*1951_1980_monthly_sums*" output=maplist.txt
r.series file=maplist.txt output=precip_0_25deg.1951.1980.sum method=sum

Makes sense?

Markus

Hi,

(attachments)

g-mlist-output.diff (4.28 KB)

···

2014-05-26 11:33 GMT+02:00 Markus Neteler <neteler@osgeo.org>:

g.mlist rast pattern=“precip1951_1980_monthly_sums” output=maplist.txt
r.series file=maplist.txt output=precip_0_25deg.1951.1980.sum method=sum

Makes sense?

yes, make sense, see patch in the attachment (it’s not complete, -p/-f ignores output option).

Martin


Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa

On Mon, May 26, 2014 at 5:33 AM, Markus Neteler <neteler@osgeo.org> wrote:

g.mlist rast pattern="precip*1951_1980_monthly_sums*" output=maplist.txt
r.series file=maplist.txt output=precip_0_25deg.1951.1980.sum method=sum

Makes sense?

It is a very good idea.

What about the standard output redirection (>)? g.mlist … > file.txt… Hmm… We can overwrite existing files…

-p and -f flags redirect outputs to a pager, so it won’t make sense for them to output to a file. Why don’t we make output=file and -p/-f mutually exclusive? See the attached patch.

(attachments)

main.c.patch (5.23 KB)

···

On Mon, May 26, 2014 at 9:53 AM, Vaclav Petras <wenzeslaus@gmail.com> wrote:


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Mon, May 26, 2014 at 5:33 AM, Markus Neteler <neteler@osgeo.org> wrote:

g.mlist rast pattern=“precip1951_1980_monthly_sums” output=maplist.txt
r.series file=maplist.txt output=precip_0_25deg.1951.1980.sum method=sum

Makes sense?

It is a very good idea.

On Mon, May 26, 2014 at 10:39 AM, Huidae Cho <grass4u@gmail.com> wrote:

What about the standard output redirection (>)? g.mlist ... > file.txt..
Hmm... We can overwrite existing files..

This does not work from GUI and in terminal, it requires additional
knowledge. I'm not sure how if this works on MS Windows but even some Linux
now don't know this.

On Mon, May 26, 2014 at 5:27 PM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

On Mon, May 26, 2014 at 10:39 AM, Huidae Cho <grass4u@gmail.com> wrote:

What about the standard output redirection (>)? g.mlist ... > file.txt..
Hmm... We can overwrite existing files..

This does not work from GUI and in terminal, it requires additional
knowledge. I'm not sure how if this works on MS Windows

It doesn't, we tried. Perhaps under some conditions but not known to me.

but even some Linux now don't know this.

The "younger" people perhaps not :slight_smile:

So it would be great and clear (and perhaps even "natural" given the
nature of a list generator) to have such an output.

Best
Markus

Makes sense. If no objections, I’ll apply the two patches in this discussion.

BTW, does r.series take input from stdin? In terminal, g.mlist ¦ r.series would be great.

On May 26, 2014 5:44 PM, “Markus Neteler” <neteler@osgeo.org> wrote:

On Mon, May 26, 2014 at 5:27 PM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

On Mon, May 26, 2014 at 10:39 AM, Huidae Cho <grass4u@gmail.com> wrote:

What about the standard output redirection (>)? g.mlist … > file.txt…
Hmm… We can overwrite existing files…

This does not work from GUI and in terminal, it requires additional
knowledge. I’m not sure how if this works on MS Windows

It doesn’t, we tried. Perhaps under some conditions but not known to me.

but even some Linux now don’t know this.

The “younger” people perhaps not :slight_smile:

So it would be great and clear (and perhaps even “natural” given the
nature of a list generator) to have such an output.

Best
Markus

Huidae Cho wrote:

BTW, does r.series take input from stdin? In terminal, g.mlist ¦ r.series
would be great.

It doesn't understand "file=-" as referring to stdin (although that
would be a simple change), but on Unix you can typically use e.g.
"g.mlist | r.series file=/dev/stdin".

--
Glynn Clements <glynn@gclements.plus.com>

On Tue, May 27, 2014 at 12:57 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Huidae Cho wrote:

BTW, does r.series take input from stdin? In terminal, g.mlist ¦ r.series
would be great.

It doesn't understand "file=-" as referring to stdin (although that
would be a simple change)

For consistency with other commands that would be a good change in r.series.

Markus

On Mon, May 26, 2014 at 11:57 PM, Huidae Cho <grass4u@gmail.com> wrote:

Makes sense. If no objections, I'll apply the two patches in this
discussion.

... btw, this would indirectly resolve
http://trac.osgeo.org/grass/ticket/1724

Markus

Just submitted r60500

···

On Tue, May 27, 2014 at 2:56 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Mon, May 26, 2014 at 11:57 PM, Huidae Cho <grass4u@gmail.com> wrote:

Makes sense. If no objections, I’ll apply the two patches in this
discussion.

… btw, this would indirectly resolve
http://trac.osgeo.org/grass/ticket/1724

Markus

Markus Neteler wrote:

>> BTW, does r.series take input from stdin? In terminal, g.mlist ¦ r.series
>> would be great.
>
> It doesn't understand "file=-" as referring to stdin (although that
> would be a simple change)

For consistency with other commands that would be a good change in r.series.

Done in r60522.

--
Glynn Clements <glynn@gclements.plus.com>

On Tue, May 27, 2014 at 9:26 AM, Huidae Cho <grass4u@gmail.com> wrote:

Just submitted r60500

Backported to relbr7 in r60587

On Tue, May 27, 2014 at 2:56 AM, Markus Neteler <neteler@osgeo.org> wrote:

...

... btw, this would indirectly resolve
http://trac.osgeo.org/grass/ticket/1724

Fixed, too.

Markus