[GRASS-dev] [GRASS GIS] #1888: r.terraflow won't run

#1888: r.terraflow won't run
-------------------------+--------------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
When trying to run r.terraflow I am getting the following error message:

{{{
Traceback (most recent call last):
   File "/usr/local/grass7/grass-7.0.svn/etc/gui/wxpython/lmg
r/frame.py", line 730, in OnMenuCmd

GUI(parent = self).ParseCommand(cmd)
   File "/usr/local/grass7/grass-7.0.svn/etc/gui/wxpython/gui
_core/forms.py", line 2229, in ParseCommand

get_dcmd = get_dcmd, layer = layer)
   File "/usr/local/grass7/grass-7.0.svn/etc/gui/wxpython/gui
_core/forms.py", line 456, in __init__

frame = self)
   File "/usr/local/grass7/grass-7.0.svn/etc/gui/wxpython/gui
_core/forms.py", line 1107, in __init__

txt3.SetValue(float(value)) # parameter previously set
   File "/usr/lib/python2.7/dist-
packages/wx-2.8-gtk2-unicode/wx/lib/agw/floatspin.py", line
767, in SetValue

if not self._textctrl or not self.InRange(value):
   File "/usr/lib/python2.7/dist-
packages/wx-2.8-gtk2-unicode/wx/lib/agw/floatspin.py", line
1143, in InRange

if (value < self._min):
   File "/usr/lib/python2.7/dist-
packages/wx-2.8-gtk2-unicode/wx/lib/agw/floatspin.py", line
1446, in __cmp__

xn, yn, p = _norm(self, other)
   File "/usr/lib/python2.7/dist-
packages/wx-2.8-gtk2-unicode/wx/lib/agw/floatspin.py", line
1597, in _norm

y = FixedPoint(y, x.p)
   File "/usr/lib/python2.7/dist-
packages/wx-2.8-gtk2-unicode/wx/lib/agw/floatspin.py", line
1320, in __init__

assert f == 0 or 0.5 <= f < 1.0
AssertionError
}}}

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

#1888: r.terraflow won't run
--------------------------------+-------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: r.terraflow, forms | Platform: Unspecified
      Cpu: Unspecified |
--------------------------------+-------------------------------------------
Changes (by martinl):

  * keywords: => r.terraflow, forms
  * component: Default => wxGUI

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

#1888: r.terraflow won't run
--------------------------------+-------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: r.terraflow, forms | Platform: Unspecified
      Cpu: Unspecified |
--------------------------------+-------------------------------------------

Comment(by annakrat):

The problem is that r.terraflow option ''d8cut'' has default value
'infinity'. The gui expects float and not string. Inside r.terraflow
answer infinity means

{{{
static const flowaccumulation_type MAX_ACCU = 1e+15;
}}}

I am not sure how to handle this special case. We can test 'infinity'
string and set maximum value of the Float Spin instead (which is currently
1e9, but it can be increased).

Anna

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

Hi Anna,

I am not sure what you mean with ‘special case’? The error message appears when I try to open the r.terraflow gui, i.e., before I can set any value.

Just to add, it works for me in GRASS 6.4 (running it right now), so I would assume it has something to do how this is implemented in GRASS 7.0?

Cheers,

Paulo

···

On Tue, Feb 19, 2013 at 12:39 PM, GRASS GIS <trac@osgeo.org> wrote:

#1888: r.terraflow won’t run

--------------------------------±------------------------------------------

Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0

Component: wxGUI | Version: svn-trunk
Keywords: r.terraflow, forms | Platform: Unspecified
Cpu: Unspecified |
--------------------------------±------------------------------------------

Comment(by annakrat):

The problem is that r.terraflow option ‘‘d8cut’’ has default value
‘infinity’. The gui expects float and not string. Inside r.terraflow
answer infinity means

{{{
static const flowaccumulation_type MAX_ACCU = 1e+15;
}}}

I am not sure how to handle this special case. We can test ‘infinity’
string and set maximum value of the Float Spin instead (which is currently
1e9, but it can be increased).

Anna


Ticket URL: <http://trac.osgeo.org/grass/ticket/1888#comment:2>
GRASS GIS <http://grass.osgeo.org>

On Tue, Feb 19, 2013 at 12:56 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

Hi Anna,

I am not sure what you mean with 'special case'? The error message appears
when I try to open the r.terraflow gui, i.e., before I can set any value.

With the special case I mean the default value 'infinity' when the
option is defined as TYPE_DOUBLE

Just to add, it works for me in GRASS 6.4 (running it right now), so I would
assume it has something to do how this is implemented in GRASS 7.0?

The difference is that in 6.4 we use TextCtrl in dialogs for float
values, but in 7 it was changed to use FloatSpin control (see for
example d.vect symbol size option). So text 'infinity' is completely
ok for TextCtrl but not for a control expecting numbers.
I don't know, maybe we should go back and use the TextCtrl widget?

Cheers,

Paulo

On Tue, Feb 19, 2013 at 12:39 PM, GRASS GIS <trac@osgeo.org> wrote:

#1888: r.terraflow won't run

--------------------------------+-------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: r.terraflow, forms | Platform: Unspecified
      Cpu: Unspecified |

--------------------------------+-------------------------------------------

Comment(by annakrat):

The problem is that r.terraflow option ''d8cut'' has default value
'infinity'. The gui expects float and not string. Inside r.terraflow
answer infinity means

{{{
static const flowaccumulation_type MAX_ACCU = 1e+15;
}}}

I am not sure how to handle this special case. We can test 'infinity'
string and set maximum value of the Float Spin instead (which is
currently
1e9, but it can be increased).

Anna

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

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

Hi,

2013/2/19 Anna Kratochvílová <kratochanna@gmail.com>:

I don't know, maybe we should go back and use the TextCtrl widget?

FloatSpin is more user-friendly in this case I would say. I would keep
it if possible. Probably we could check default answer, and when it's
not a number then use TextCtrl instead of FloatSpin. Or to change
default answer in r.terraflow to a number.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2013/2/19 Martin Landa <landa.martin@gmail.com>:

[...]

not a number then use TextCtrl instead of FloatSpin. Or to change
default answer in r.terraflow to a number.

or probably in the best case to remove default answer, eg.

        d8cut Routing using SFD (D8) direction
                  If flow accumulation is larger than this value it is
routed using SFD (D8) direction (meaningfull only for MFD flow). *If
not give, the use infinity.*

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Tue, Feb 19, 2013 at 1:14 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2013/2/19 Martin Landa <landa.martin@gmail.com>:

[...]

not a number then use TextCtrl instead of FloatSpin. Or to change
default answer in r.terraflow to a number.

or probably in the best case to remove default answer, eg.

        d8cut Routing using SFD (D8) direction
                  If flow accumulation is larger than this value it is
routed using SFD (D8) direction (meaningfull only for MFD flow). *If
not give, the use infinity.*

I agree with this solution.

Anna

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2013/2/19 Anna Kratochvílová <kratochanna@gmail.com>:

or probably in the best case to remove default answer, eg.

        d8cut Routing using SFD (D8) direction
                  If flow accumulation is larger than this value it is
routed using SFD (D8) direction (meaningfull only for MFD flow). *If
not give, the use infinity.*

I agree with this solution.

done in r55119. Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Anna wrote:

With the special case I mean the default value 'infinity'
when the option is defined as TYPE_DOUBLE

just to note inf, -inf, and nan are perfectly valid IEEE floating
point values. they don't make much sense with a spinbox of course,
but if the wx widget doesn't accept them for a FP input, then
a bug/wish should be filed upstream with them.

best,
Hamish

Hamish wrote:

> With the special case I mean the default value 'infinity'
> when the option is defined as TYPE_DOUBLE

just to note inf, -inf, and nan are perfectly valid IEEE floating
point values. they don't make much sense with a spinbox of course,
but if the wx widget doesn't accept them for a FP input, then
a bug/wish should be filed upstream with them.

On a related note: how does a spinbox deal with e.g. 1e300 or 1e-300?

The spinbox concept was designed for integers; I'm not sure that it's
useful for floating-point values.

--
Glynn Clements <glynn@gclements.plus.com>

#1888: r.terraflow won't run
--------------------------------+-------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: r.terraflow, forms | Platform: Unspecified
      Cpu: Unspecified |
--------------------------------+-------------------------------------------

Comment(by annakrat):

The situation is following: in r55119 no answer is required which results
in default answer infinity, then in r55484 we started to use wx.TextCtrl
instead of wx.FloatSpinCtrl. Two simple solutions exist, either leave it
as it is, or revert r55119 but instead of "infinity" use "inf" because
forms.py use a Float validator for this text field and "inf" is a valid
number. I think we could leave it as it is and close this ticket.
Objections?

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

#1888: r.terraflow won't run
--------------------------+-------------------------------------------------
  Reporter: pvanbosgeo | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: r.terraflow, forms
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by annakrat):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:3 annakrat]:
> The situation is following: in r55119 no answer is required which
results in default answer infinity, then in r55484 we started to use
wx.TextCtrl instead of wx.FloatSpinCtrl. Two simple solutions exist,
either leave it as it is, or revert r55119 but instead of "infinity" use
"inf" because forms.py use a Float validator for this text field and "inf"
is a valid number. I think we could leave it as it is and close this
ticket. Objections?

no objections, so I close the ticket

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