[GRASS-user] [d.*] command not executing from standalone script
Martin Landa
landa.martin at gmail.com
Wed Jan 4 03:17:21 PST 2017
Hi,
2017-01-04 11:59 GMT+01:00 Ang Sherpa <angsherpa232 at gmail.com>:
> My script work from "Launch Script" command within Grass Gis environment.
> However, as a standalone script it just executes nothing not even error. So,
> sleep.time(2) is also not working as expected. Am I missing something?
> I have attached the script that I used herewith this mail.
>
> Will be looking forward to hearing from you.
interactive monitors require running GRASS. It is probably reason why
wx monitor is not even launched since your script already terminates
(and GRASS session too). It has no reason to use interactive monitors
outside of GRASS. If you modify your script like:
gscript.run_command('d.mon', stop='wx6') # we asssume that there is
already monitors hanging from last run
gscript.run_command('d.mon',start='wx6',resolution='1')
time.sleep(2)
gscript.run_command('d.rast',map='elevation')
time.sleep(200)
os.remove(rcfile)
Then monitor shows and will running 200sec. But it has no sense. So I
suggest you to use:
1) file-based monitors (which is natural for script, generate
something, render to file and close)
script.run_command('d.mon',start='cairo',resolution='1',
output="/path/image.png")
# no need to sleep
gscript.run_command('d.rast',map='elevation')
gscript.run_command('d.mon', stop='cairo')
or
2) launch your script from running GRASS
Ma
--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
More information about the grass-user
mailing list