[GRASS-dev] [GRASS-SVN] r66774 - grass-addons/grass7/imagery/i.segment.stats

On Mon, Nov 9, 2015 at 8:52 AM, <svn_grass@osgeo.org> wrote:

Author: mlennert
Date: 2015-11-09 05:52:29 -0800 (Mon, 09 Nov 2015)
New Revision: 66774

Modified:
   grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
Log:
clumped map is a raster, not a vector

Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py

--- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
2015-11-09 12:06:44 UTC (rev 66773)
+++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
2015-11-09 13:52:29 UTC (rev 66774)
@@ -82,8 +82,8 @@
     if grass.find_file(temporary_vect, element='vector')['name']:
             grass.run_command('g.remove', flags='f', type_='vector',
                     name=temporary_vect, quiet=True)
- if grass.find_file(temporary_clumped_rast, element='vector')['name']:
- grass.run_command('g.remove', flags='f', type_='vector',
+ if grass.find_file(temporary_clumped_rast, element='raster')['name']:
+ grass.run_command('g.remove', flags='f', type_='raster',

I'm pretty sure that find_file wants cell for rasters (regardless of type).
Does this work for you?

https://trac.osgeo.org/grass/changeset/66774
https://grass.osgeo.org/grass71/manuals/libpython/_modules/script/core.html#find_file

                     name=temporary_clumped_rast, quiet=True)
     if insert_sql:
         os.remove(insert_sql)

_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-commit

On Mon, Nov 9, 2015 at 9:45 AM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

I'm pretty sure that find_file wants cell for rasters (regardless of type).

This is true about g.findfile. find_file gives warning for convenience of
the developer at expense of confused user. I actually implemented similar
function (now focused just on gunittest) which explicitly supports the
normal names (i.e. not g.findfile element names but g.list types). Would
this function be helpful for you if it would be in grass.script.utils or
core?

https://grass.osgeo.org/grass71/manuals/libpython/_modules/gunittest/gutils.html#is_map_in_mapset

On 09/11/15 15:45, Vaclav Petras wrote:

On Mon, Nov 9, 2015 at 8:52 AM, <svn_grass@osgeo.org
<mailto:svn_grass@osgeo.org>> wrote:

    Author: mlennert
    Date: 2015-11-09 05:52:29 -0800 (Mon, 09 Nov 2015)
    New Revision: 66774

    Modified:
        grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
    <http://i.segment.stats.py>
    Log:
    clumped map is a raster, not a vector

    Modified:
    grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
    <http://i.segment.stats.py>
    ===================================================================
    --- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
    <http://i.segment.stats.py> 2015-11-09 12:06:44 UTC (rev 66773)
    +++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
    <http://i.segment.stats.py> 2015-11-09 13:52:29 UTC (rev 66774)
    @@ -82,8 +82,8 @@
          if grass.find_file(temporary_vect, element='vector')['name']:
                  grass.run_command('g.remove', flags='f', type_='vector',
                          name=temporary_vect, quiet=True)
    - if grass.find_file(temporary_clumped_rast,
    element='vector')['name']:
    - grass.run_command('g.remove', flags='f', type_='vector',
    + if grass.find_file(temporary_clumped_rast,
    element='raster')['name']:
    + grass.run_command('g.remove', flags='f', type_='raster',

I'm pretty sure that find_file wants cell for rasters (regardless of
type). Does this work for you?

https://trac.osgeo.org/grass/changeset/66774
https://grass.osgeo.org/grass71/manuals/libpython/_modules/script/core.html#find_file

Actually, for me it does seem to work (because of the alias in etc/element_list ?), but I changed it to cell anyhow.

Thanks for the heads up !

Moritz