[GRASS-dev] [GRASS GIS] #2699: g.gui.iclass doesn't run after selecting training areas

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+-------------------------
Reporter: ThayseNery | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.1
Component: Default | Version: 7.0.0
Keywords: | CPU: x86-64
Platform: MSWindows 7 |
-------------------------+-------------------------
Hi,

I have been trying to apply supervised classification using
'''g.gui.iclass''' in GRASS GIS 7.0.1RC1 windows but it doesn't work
properly. What I do:

1) Launch g.gui.iclass
I can open the module by selecting group and imagery subgroup. But when
the windows GRASS Supervised Classification Tool opens, I observed that
name of imagery subgroup is missing. By adding it through select imagery
group I got the following error:

   ''File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\toolbars.py", line 163, in <lambda>
     lambda event : self.parent.AddBands()),
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 513, in AddBands
     subgroup=self.g['subgroup'])
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\signal.py", line 229, in emit
     dispatcher.send(signal=self, *args, **kwargs)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\dispatcher.py", line 349, in send
     **named
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\robustapply.py", line 60, in
robustApply
     return receiver(*arguments, **named)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\controllers.py", line 1111, in GroupSet
     self.scatt_mgr.SetBands(bands)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\controllers.py", line 164, in SetBands
     i = GetRasterInfo(b)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\iscatt_core.py", line 832, in GetRasterInfo
     raise GException("r.info failed:\n%s" % msg)
core.gcmd.GException: r.info failed:
Illegal filename <PERMANENT
>. Character not allowed.''

My file name doesn’t have any special character as it is called feb2014.

Although the imagery subgroup cannot been opened, I am able to:
2) Add RGB map layer
3) Add a class in the class manager and assign a custom color
5) I can digitize new area

But After selecting some training areas, I try to run the model and I got
another error:

   ''File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 911, in OnRunAnalysis
     if self.RunAnalysis():
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 922, in RunAnalysis
     if not self.CheckInput(group = self.g['group'], vector =
self.trainingAreaVector):
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 1087, in CheckInput
     rasterInfo = grass.raster_info(groupLayers[0])
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\raster.py", line 70, in raster_info
     s = read_command('r.info', flags='gre', map=map)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\core.py", line 427, in read_command
     return handle_errors(returncode, stdout, args, kwargs)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\core.py", line 312, in handle_errors
     returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['r.info', '-gre',
u'map=Feb2014_111_112_753mos@PERMANENT\r'] ended with error
Process ended with non-zero return code 1. See errors in the (error)
output.''

I have been trying to work with this module for a week and I cannot figure
out why it doesn’t work.

Many thanks in advance for any help.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------
Changes (by martinl):

* keywords: => g.gui.iclass
* component: Default => wxGUI

Old description:

Hi,

I have been trying to apply supervised classification using
'''g.gui.iclass''' in GRASS GIS 7.0.1RC1 windows but it doesn't work
properly. What I do:

1) Launch g.gui.iclass
I can open the module by selecting group and imagery subgroup. But when
the windows GRASS Supervised Classification Tool opens, I observed that
name of imagery subgroup is missing. By adding it through select imagery
group I got the following error:

  ''File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\toolbars.py", line 163, in <lambda>
    lambda event : self.parent.AddBands()),
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 513, in AddBands
    subgroup=self.g['subgroup'])
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\signal.py", line 229, in emit
    dispatcher.send(signal=self, *args, **kwargs)
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\dispatcher.py", line 349, in send
    **named
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\robustapply.py", line 60, in
robustApply
    return receiver(*arguments, **named)
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\controllers.py", line 1111, in GroupSet
    self.scatt_mgr.SetBands(bands)
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\controllers.py", line 164, in SetBands
    i = GetRasterInfo(b)
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\iscatt_core.py", line 832, in GetRasterInfo
    raise GException("r.info failed:\n%s" % msg)
core.gcmd.GException: r.info failed:
Illegal filename <PERMANENT
>. Character not allowed.''

My file name doesn’t have any special character as it is called feb2014.

Although the imagery subgroup cannot been opened, I am able to:
2) Add RGB map layer
3) Add a class in the class manager and assign a custom color
5) I can digitize new area

But After selecting some training areas, I try to run the model and I got
another error:

  ''File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 911, in OnRunAnalysis
    if self.RunAnalysis():
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 922, in RunAnalysis
    if not self.CheckInput(group = self.g['group'], vector =
self.trainingAreaVector):
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 1087, in CheckInput
    rasterInfo = grass.raster_info(groupLayers[0])
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\raster.py", line 70, in raster_info
    s = read_command('r.info', flags='gre', map=map)
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\core.py", line 427, in read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\core.py", line 312, in handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['r.info', '-gre',
u'map=Feb2014_111_112_753mos@PERMANENT\r'] ended with error
Process ended with non-zero return code 1. See errors in the (error)
output.''

I have been trying to work with this module for a week and I cannot
figure out why it doesn’t work.

Many thanks in advance for any help.

New description:

Hi,

I have been trying to apply supervised classification using
'''g.gui.iclass''' in GRASS GIS 7.0.1RC1 windows but it doesn't work
properly. What I do:

1) Launch g.gui.iclass
I can open the module by selecting group and imagery subgroup. But when
the windows GRASS Supervised Classification Tool opens, I observed that
name of imagery subgroup is missing. By adding it through select imagery
group I got the following error:

{{{
   ''File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\toolbars.py", line 163, in <lambda>
     lambda event : self.parent.AddBands()),
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 513, in AddBands
     subgroup=self.g['subgroup'])
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\signal.py", line 229, in emit
     dispatcher.send(signal=self, *args, **kwargs)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\dispatcher.py", line 349, in send
     **named
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\pydispatch\robustapply.py", line 60, in
robustApply
     return receiver(*arguments, **named)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\controllers.py", line 1111, in GroupSet
     self.scatt_mgr.SetBands(bands)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\controllers.py", line 164, in SetBands
     i = GetRasterInfo(b)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iscatt\iscatt_core.py", line 832, in GetRasterInfo
     raise GException("r.info failed:\n%s" % msg)
core.gcmd.GException: r.info failed:
Illegal filename <PERMANENT
>. Character not allowed.''
}}}

My file name doesn’t have any special character as it is called feb2014.

Although the imagery subgroup cannot been opened, I am able to:
2) Add RGB map layer
3) Add a class in the class manager and assign a custom color
5) I can digitize new area

But After selecting some training areas, I try to run the model and I got
another error:

{{{
   ''File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 911, in OnRunAnalysis
     if self.RunAnalysis():
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 922, in RunAnalysis
     if not self.CheckInput(group = self.g['group'], vector =
self.trainingAreaVector):
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\gui\wxpython\iclass\frame.py", line 1087, in CheckInput
     rasterInfo = grass.raster_info(groupLayers[0])
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\raster.py", line 70, in raster_info
     s = read_command('r.info', flags='gre', map=map)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\core.py", line 427, in read_command
     return handle_errors(returncode, stdout, args, kwargs)
   File "C:\Program Files (x86)\GRASS GIS
7.0.1RC1\etc\python\grass\script\core.py", line 312, in handle_errors
     returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['r.info', '-gre',
u'map=Feb2014_111_112_753mos@PERMANENT\r'] ended with error
Process ended with non-zero return code 1. See errors in the (error)
output.''
}}}

I have been trying to work with this module for a week and I cannot figure
out why it doesn’t work.

Many thanks in advance for any help.

--

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------

Comment (by ThayseNery):

Additional information, the image is landsat 8 OIL and the bands were
convert from DNs to ToA Reflectance.

The second error was fixed but I still got the first error when I select
the imagery subgroup.

Now I am able to run the model but the '''histogram shape''' does not
follow the bell curve. According to the tutorial it should
https://www.youtube.com/watch?v=FyzfdlkTNRg.
[[Image(histogram2.jpg) attached]]

Additionally, I don't see difference between the classes in the preview
classification, when I select "agriculture" for example, in the preview
shows that it takes the whole area, if I select "vegetation" it shows that
this represents the whole area as well. I have selected 10 training areas
for each class.

Although the histogram doesn't look ideal, I was able to export the
training areas to a vector map but I cannot import the vector into
g.gui.iclass to rerun the analysis. I got the following error:

Traceback (most recent call last): File "C:\Program Files (x86)\GRASS GIS
7.0.0\gui\wxpython\iclass\frame.py", line 537, in OnImportAreas
self.ImportAreas(vName) File "C:\Program Files (x86)\GRASS GIS
7.0.0\gui\wxpython\iclass\frame.py", line 594, in ImportAreas
self.poMapInfo = digitClass.OpenMap(vname, tmp = True) File "C:\Program
Files (x86)\GRASS GIS 7.0.0\gui\wxpython\vdigit\wxdigit.py", line 1649, in
OpenMap self.poMapInfo = self._display.OpenMap(str(name), str(mapset),
update, tmp) File "C:\Program Files (x86)\GRASS GIS
7.0.0\gui\wxpython\vdigit\wxdisplay.py", line 962, in OpenMap
Vect_set_updated(self.poMapInfo, True) # track updated lines at update
mode WindowsError: exception: access violation reading 0x000002E4

I can see the vectors in the display. I opened the vector table of
contents and I can see all categories, but the columns are empty and it is
not specified how many training sample are within each class. It might be
related to my histogram explained above [[Image(table_classes.PNG)
attached]]

Any suggestions on how I might fix it?

Thanks for any help.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------
Changes (by ThayseNery):

* Attachment "histogram2.jpg" added.

Histogram after selecting training areas

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------
Changes (by ThayseNery):

* Attachment "histogram2.jpg" removed.

Histogram after selecting training areas

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------
Changes (by ThayseNery):

* Attachment "table_classes.PNG" added.

vector table of contents (columns are empty)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------

Comment (by annakrat):

Thank you for the extensive description. I can confirm this problem on
Windows 8, however it works on my Ubuntu laptop.

If you need to do it on Windows, you could try for now less interactive
way - using vector digitizer to digitize training areas (which you
probably already have), rasterize it (v.to.rast) and generate signature
file using i.gensig.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+--------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+--------------------------

Comment (by ThayseNery):

Thanks annakrat. I will tray to do as you explained. I don't have all
training areas yet.

Since I need to have many training areas for the same category, I think I
should create an column called "category" and an additional column to
store the description of the categories that I will assign to my training
dataset. Is that right? It seems to be really time consuming since I need
always to write the description and category.

Do you have any tips on how to do it more efficient?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+-------------------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass, digitizer
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+-------------------------------------
Changes (by annakrat):

* keywords: g.gui.iclass => g.gui.iclass, digitizer

Comment:

Issues reported in the ticket description should be fixed in r65506, will
be backported once tested. The export of training areas is fixed as well.

'''Remaining problems'''

This happens when g.gui.iclass window is opened, even on Linux:
{{{
G__open(read): Unable to open 'C:\Users\akratoc\grassdata/nc
_spm_08_grass7/user1/.tmp/unknown/vector/trAreas64800/frmt':
No such file or directory
}}}

This happens only on Windows when trying to import previously saved
training areas:
{{{
Traceback (most recent call last):
   File "C:\Program Files (x86)\GRASS GIS
7.1.svn\gui\wxpython\iclass\frame.py", line 538, in
OnImportAreas

self.ImportAreas(vName)
   File "C:\Program Files (x86)\GRASS GIS
7.1.svn\gui\wxpython\iclass\frame.py", line 595, in
ImportAreas

self.poMapInfo = digitClass.OpenMap(vname, tmp = True)
   File "C:\Program Files (x86)\GRASS GIS
7.1.svn\gui\wxpython\vdigit\wxdigit.py", line 1649, in
OpenMap

self.poMapInfo = self._display.OpenMap(str(name),
str(mapset), update, tmp)
   File "C:\Program Files (x86)\GRASS GIS
7.1.svn\gui\wxpython\vdigit\wxdisplay.py", line 962, in
OpenMap

Vect_set_updated(self.poMapInfo, True) # track updated lines
at update mode
WindowsError
:
exception: access violation reading 0x000002E4
}}}

I would appreciate some help with this.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2699#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#2699: g.gui.iclass doesn't run after selecting training areas
-------------------------+-------------------------------------
  Reporter: ThayseNery | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.1
Component: wxGUI | Version: 7.0.0
Resolution: | Keywords: g.gui.iclass, digitizer
       CPU: x86-64 | Platform: MSWindows 7
-------------------------+-------------------------------------

Comment (by annakrat):

r65506 backported in r65517.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2699#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>