[GRASS-user] GRASS 7.0.0 Issues with Object Based Image Analysis
Jake Chila
jake.chila at gmail.com
Fri May 15 06:56:16 PDT 2015
HI all,
So I think I figured it out with help from Vaclav. When I launch the script
from within the GUI the real errors are displayed in the Command Console.
The issue I was having had to do with mislabelled column names; I was using
numbers are the first character (my database management skills need some
refinement apparently).
Now the script works when I launch it from within the GUI (no error
messages in the command line), but when I launch the script from outside of
Grass it is giving me grief.
Here is the code I am running:
MAPS = grass.read_command('i.group',
group='LE7_SEG',
flags='g',
quiet=True).splitlines()
for maps in MAPS:
band=maps.split('@',1)[0]
bnum=band[-2:]
grass.run_command('v.build',
map='LE7_2001_SEG',
option='build')
grass.run_command('v.rast.stats',
map='LE7_2001_SEG',
flags='c',
raster=band,
method='median',
column_prefix='%s' % bnum)
grass.run_command('v.db.update',
map='LE7_2001_SEG',
column='bright',
qcolumn='bright+%s_median' %bnum)
grass.run_command('v.db.dropcolumn',
map='LE7_2001_SEG',
column = '%s_median' % bnum)
I have to include the v.build command because, for some reason, the polygon
topology needs to be rebuilt every time I try to use it. The code also
includes all the environment settings needed to access GRASS which I know
work because the script gets past the v.build command and repeatedly fails
on the v.rast.stats command.
Thanks,
JDC
On Thu, May 14, 2015 at 5:23 PM, Vaclav Petras <wenzeslaus at gmail.com> wrote:
>
> On Thu, May 14, 2015 at 2:00 PM, Jake Chila <jake.chila at gmail.com> wrote:
> >
> > The first issue I ran into was trying to the python code (about halfway
> down the page, "for maps in MAPS"). I have changed the parameters so they
> suit GRASS 7.0 but I still receive this error:
> >
> > Traceback (most recent call last):
> > File "C:\Users\Jacob\Desktop\Python\SEG_DB_MAN.py", line 111, in
> <module>
> > column_prefix='%s' % bnum)
> > File "C:\Program Files (x86)\GRASS GIS
> 7.0.0\etc\python\grass\script\core.py", line 375, in run_command
> > return handle_errors(returncode, returncode, args, kwargs)
> > File "C:\Program Files (x86)\GRASS GIS
> 7.0.0\etc\python\grass\script\core.py", line 310, in handle_errors
> > returncode=returncode)
> > CalledModuleError: Module run None ['v.rast.stats', '-c',
> 'map=LE7_2001_SEG', 'column_prefix=B1', 'method=median',
> 'raster=LE7_ATCORR_2001_B1'] ended with error
> > Process ended with non-zero return code 1. See errors in the (error)
> output.
>
> Hi, are there any other errors above or elsewhere the output? The actual
> error messages start with "ERROR:". (I guess I should add this note to the
> error message.) Vaclav
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150515/ad5f5a78/attachment.html>
More information about the grass-user
mailing list