~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to scripts/d.what.rast/d.what.rast.py

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
############################################################################
 
4
#
 
5
# MODULE:    d.what.rast
 
6
# AUTHOR(S): Anna Petrasova <kratochanna gmail.com>
 
7
# PURPOSE:   Script for querying raster maps in d.mon
 
8
# COPYRIGHT: (C) 2014 by the GRASS Development Team
 
9
#
 
10
#               This program is free software under the GNU General
 
11
#               Public License (>=v2). Read the file COPYING that
 
12
#               comes with GRASS for details.
 
13
#
 
14
#############################################################################
 
15
 
 
16
#%module
 
17
#% description: Allows the user to interactively query raster map layers at user-selected locations.
 
18
#% keyword: display
 
19
#% keyword: vector
 
20
#%end
 
21
#%option G_OPT_R_INPUTS
 
22
#% key: map
 
23
#%end
 
24
 
 
25
 
 
26
from grass.script import core as gcore
 
27
 
 
28
 
 
29
def main():
 
30
    options, flags = gcore.parser()
 
31
    gisenv = gcore.gisenv()
 
32
    if 'MONITOR' in gisenv:
 
33
        cmd_file = gisenv['MONITOR_{monitor}_CMDFILE'.format(monitor=gisenv['MONITOR'].upper())]
 
34
        dout_cmd = 'd.what.rast'
 
35
        for param, val in options.iteritems():
 
36
            if val:
 
37
                dout_cmd += " {param}={val}".format(param=param, val=val)
 
38
        with open(cmd_file, "a") as file_:
 
39
            file_.write(dout_cmd)
 
40
    else:
 
41
        gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
 
42
 
 
43
 
 
44
if __name__ == "__main__":
 
45
    main()