Opened 4 years ago

Last modified 7 months ago

#2699 new defect

g.gui.iclass doesn't run after selecting training areas

Reported by: ThayseNery Owned by: grass-dev@…
Priority: major Milestone: 7.6.2
Component: wxGUI Version: 7.0.0
Keywords: g.gui.iclass, digitizer Cc:
CPU: x86-64 Platform: MSWindows 7

Description (last modified by martinl)

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.

Attachments (2)

histogram2.jpg (70.5 KB) - added by ThayseNery 4 years ago.
Histogram after selecting training areas
table_classes.PNG (34.5 KB) - added by ThayseNery 4 years ago.
vector table of contents (columns are empty)

Download all attachments as: .zip

Change History (25)

comment:1 Changed 4 years ago by martinl

Component: DefaultwxGUI
Description: modified (diff)
Keywords: g.gui.iclass added

comment:2 Changed 4 years ago 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.

Changed 4 years ago by ThayseNery

Attachment: histogram2.jpg added

Histogram after selecting training areas

Changed 4 years ago by ThayseNery

Attachment: table_classes.PNG added

vector table of contents (columns are empty)

comment:3 Changed 4 years ago 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.

comment:4 Changed 4 years ago 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?

comment:5 Changed 4 years ago by annakrat

Keywords: digitizer added

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.

comment:6 Changed 4 years ago by annakrat

r65506 backported in r65517.

comment:7 Changed 4 years ago by neteler

Milestone: 7.0.17.0.2

Ticket retargeted after 7.0.1 milestone closed

comment:8 Changed 4 years ago by annakrat

Milestone: 7.0.27.1.0

comment:9 Changed 4 years ago by neteler

Milestone: 7.1.07.2.0

Milestone renamed

comment:10 Changed 3 years ago by neteler

Can anyone test the backport on Windows, please?

comment:11 in reply to:  10 ; Changed 3 years ago by hellik

Replying to neteler:

Can anyone test the backport on Windows, please?

is there an example/tutorial how to use?

comment:12 in reply to:  11 ; Changed 3 years ago by hellik

Replying to hellik:

Replying to neteler:

Can anyone test the backport on Windows, please?

is there an example/tutorial how to use?

tested now with

System Info                                                                     
GRASS version: 7.0.5                                                            
GRASS SVN Revision: 69636                                                       
Build Date: 2016-10-02                                                          
Build Platform: x86_64-w64-mingw32                                              
GDAL/OGR: 2.1.1                                                                 
PROJ.4: 4.9.3                                                                   
GEOS: 3.5.0                                                                     
SQLite: 3.14.1                                                                  
Python: 2.7.5                                                                   
wxPython: 2.8.12.1                                                              
Platform: Windows-8-6.2.9200 

most works ok, beside import of vector training areas fails with (as reported above):

Traceback (most recent call last):
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\iclass\frame.py", line 537, in
OnImportAreas

self.ImportAreas(vName)
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\iclass\frame.py", line 594, in
ImportAreas

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

self.poMapInfo = self._display.OpenMap(str(name),
str(mapset), update, tmp)
  File "C:\Program Files\GRASS GIS
7.0.5\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 0x0000000000000340

vector training area:

v.report map=mytraining@testiclass option=area                                  
cat|class|color|n_cells|band1_min|band2_min|band3_min|band4_min|band5_min|band6_min|band7_min|band1_mean|band2_mean|band3_mean|band4_mean|band5_mean|band6_mean|band7_mean|band1_max|band2_max|band3_max|band4_max|band5_max|band6_max|band7_max|area
1|water|0:0:255|941|15|109|7|1|19|58|1|19.2412319183|113.167907715|9.20616340637|1.95217847824|22.2114772797|63.0531349182|5.13283729553|31|115|56|24|31|70|64|730860.494204
2|forest|0:255:0|674|13|109|41|5|19|56|26|19.4569740295|110.860534668|63.3709182739|11.9821958542|22.9020767212|62.1023750305|43.0637969971|31|115|94|27|30|73|73|500610.799864

comment:13 in reply to:  12 ; Changed 3 years ago by hellik

Replying to hellik:

most works ok, beside import of vector training areas fails with (as reported above):

also there are no scatterplots displayed.

comment:14 in reply to:  13 Changed 3 years ago by hellik

Replying to hellik:

Replying to hellik:

most works ok, beside import of vector training areas fails with (as reported above):

also there are no scatterplots displayed.

some further error messages:

Command 'd.rast --quiet map=mycomp@testiclass' failed
Details: Neither MONITOR (managed by d.mon command) nor
GRASS_RENDER_IMMEDIATE (used for direct rendering) defined
Exception in thread Thread-25:
Traceback (most recent call last):
  File "C:\Program Files\GRASS GIS
7.0.5\Python27\lib\threading.py", line 808, in
__bootstrap_inner
    self.run()
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\core\gthread.py", line 94, in run
    ret = vars()['callable'](*args, **kwds)
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\iscatt\iscatt_core.py", line 256, in
EditedFeature
    self._updateCatRast(bboxs[i], areas_cats[i],
updated_cats)
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\iscatt\iscatt_core.py", line 281, in
_updateCatRast
    self._rasterize(grass_region, layer, cat, patch_rast)
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\iscatt\iscatt_core.py", line 324, in
_rasterize
    env = environs)
  File "C:\Program Files\GRASS GIS
7.0.5\gui\wxpython\core\gcmd.py", line 675, in RunCommand
    ps = grass.start_command(prog, flags, overwrite, quiet,
verbose, **kwargs)
  File "C:\Program Files\GRASS GIS
7.0.5\etc\python\grass\script\core.py", line 362, in
start_command
    return Popen(args, **popts)
  File "C:\Program Files\GRASS GIS
7.0.5\etc\python\grass\script\core.py", line 65, in __init__
    subprocess.Popen.__init__(self, args, **kwargs)
  File "C:\Program Files\GRASS GIS
7.0.5\Python27\lib\subprocess.py", line 711, in __init__
    errread, errwrite)
  File "C:\Program Files\GRASS GIS
7.0.5\Python27\lib\subprocess.py", line 948, in
_execute_child
    startupinfo)
TypeError: environment can only contain strings
Command 'd.rast --quiet map=class_1_1188.0' failed
Details: Neither MONITOR (managed by d.mon command) nor
GRASS_RENDER_IMMEDIATE (used for direct rendering) defined
Command 'd.rast --quiet map=class_2_1188.1' failed
Details: Neither MONITOR (managed by d.mon command) nor
GRASS_RENDER_IMMEDIATE (used for direct rendering) defined
C:\Program Files\GRASS GIS 7.0.5\Python27\lib\site-
packages\wx-2.8-msw-unicode\wx\lib\plot.py:1164:
FutureWarning: comparison to `None` will result in an
elementwise object comparison in the future.
  if xAxis == None or yAxis == None:

comment:15 in reply to:  12 Changed 3 years ago by hellik

Replying to hellik:

Replying to hellik:

Replying to neteler:

Can anyone test the backport on Windows, please?

is there an example/tutorial how to use?

tested now with

System Info                                                                     
GRASS version: 7.0.5                                                            
GRASS SVN Revision: 69636                                                       
Build Date: 2016-10-02                                                          
Build Platform: x86_64-w64-mingw32                                              
GDAL/OGR: 2.1.1                                                                 
PROJ.4: 4.9.3                                                                   
GEOS: 3.5.0                                                                     
SQLite: 3.14.1                                                                  
Python: 2.7.5                                                                   
wxPython: 2.8.12.1                                                              
Platform: Windows-8-6.2.9200 

now testing with

System Info                                                                     
GRASS version: 7.3.svn                                                          
GRASS SVN revision: r69851                                                      
Build date: 2016-11-20                                                          
Build platform: x86_64-w64-mingw32                                              
GDAL: 2.1.2                                                                     
PROJ.4: 4.9.3                                                                   
GEOS: 3.5.0                                                                     
SQLite: 3.14.1                                                                  
Python: 2.7.5                                                                   
wxPython: 2.8.12.1                                                              
Platform: Windows-8-6.2.9200 (OSGeo4W)  

loading the image group/subgroup:

G__open(read): Unable to open 'D:\grassdata\nc_spm_08_grass7
\testiclass\.tmp/unknown/vector/trAreas90240\frmt': No such
file or directory

screening this folder

D:\grassdata\nc_spm_08_grass7\testiclass\.tmp\unknown\vector\trAreas90240>dir /b
coor
dbln
head
hist
sidx

there isn't a file/directory with this name.

comment:16 Changed 3 years ago by neteler

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:17 Changed 3 years ago by martinl

Milestone: 7.2.17.2.2

comment:18 Changed 2 years ago by mlennert

Has there been any progress on this ? Other experiences by Windows users ? It would be nice if this could work even on Windows...

comment:19 Changed 2 years ago by neteler

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:20 Changed 21 months ago by mlennert

Working with a colleague I could just confirm both issues on a fresh osgeo4w 7.4 install: I get the

G__open(read): Unable to open '$PATH\frmt': No such file or directory

error when launching the module and the

exception: access violation reading 0x0000000000000340

when trying to load an existing map.

The first error also appears in GNU/Linux using the Debian 7.4 package.

I don't understand why it is looking for a frmt file. AFAIU, this file is only used for maps linked to using v.external.

comment:21 Changed 20 months ago by martinl

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:22 Changed 20 months ago by martinl

Milestone: 7.2.4

comment:23 Changed 7 months ago by martinl

Milestone: 7.2.47.6.2
Note: See TracTickets for help on using tickets.