Opened 4 years ago

Closed 3 years ago

#2721 closed enhancement (fixed)

t.rast.what: allow stdin and add to GRASS 7.0

Reported by: sbl Owned by: grass-dev@…
Priority: normal Milestone: 7.2.0
Component: Default Version: unspecified
Keywords: t.rast.what Cc:
CPU: Unspecified Platform: All

Description

Please find attached a diff which allows t.rast.what to read from stdin. That way it becomes also possible to add a site name to the output, which is pretty useful for later useage of it... The site name is only propagated to the output, when a site name has been provided in the (first line of the) input.

There are probably more elegant solutions for this, so improvements are very welcome. I did not update the manual and the test suite yet, but I will try to do so, if you consider this addition useful too...

For users with "commandlineophobia" it would be probably better to specify coordinates using the file option G_OPT_F_INPUT?

Furthermore, the script works very well in GRASS 7.0 too. Any particular reason for not shipping it with the stable release? t.rast.what is a pretty handy tool!

Attachments (2)

t.rast.what.diff (7.6 KB) - added by sbl 4 years ago.
Allow t.rast.what to read from stdin
t.rast.what_fileinput.diff (2.7 KB) - added by sbl 4 years ago.
Add file input option to t.rast.what

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by sbl

Attachment: t.rast.what.diff added

Allow t.rast.what to read from stdin

comment:1 Changed 4 years ago by huhabla

I have applied your patch in r65964 with some modifications. Thanks a lot for this improvement. I have introduced the flag "-i" to expect stdin input, otherwise stdin.read() will block if coordinates or point input are not set.

About a backport to 7.0.*, t.rast.what is still alpha or beta state, it should be further improved [*] and more tested before backporting.

[*] Supporting site names from vector files, input files with coordinates, output transformation with lower memory footprint, ...

Changed 4 years ago by sbl

Attachment: t.rast.what_fileinput.diff added

Add file input option to t.rast.what

comment:2 Changed 4 years ago by sbl

In order to support "input files with coordinates" I created a new tiny diff. Please review. I can update the manual accordingly, if you like.

Maybe the coordinates option can be removed as the same functionality is available through file/stdin input? Just a proper check of the input coordinates pair(s) is missing...

For site names from vector files I guess r.what should be improved first, don`t you think?

Would you mind if I try to get the script into the new GRASS plugin in QGIS, marking it as experimental? This module is definitely a good candidate for functionality users with limited knowledge of GRASS / TGIS can benefit from very much... And a nice teaser for the power of TGIS...

Last edited 4 years ago by sbl (previous) (diff)

comment:3 Changed 4 years ago by neteler

Just for the record: there is also a new t.rast.whatcsv. See

https://svn.osgeo.org/grass/grass-addons/grass7/temporal/t.rast.whatcsv/t.rast.whatcsv.html

comment:4 Changed 4 years ago by neteler

Milestone: 7.0.27.0.3

Ticket retargeted after milestone closed

comment:5 Changed 4 years ago by sbl

Milestone: 7.0.37.0.4

comment:6 Changed 3 years ago by martinl

Milestone: 7.0.47.0.5

comment:7 Changed 3 years ago by martinl

Milestone: 7.0.57.2.0
Resolution: fixed
Status: newclosed

The patch is part of GRASS 7.2, changing the milestone and closing.

Note: See TracTickets for help on using tickets.