[GRASS-dev] graphical modeler results

Here are some results of my experiments with the graphical modeler in GRASS 6.5. Question: is the code the same for the modeler across all GRASS versions currently?

I tried to create a model that did the following steps using the Spearfish demo data set:

  1. convert the vector streams map to raster
  2. run r.buffer on the rasterized streams
  3. convert the raster buffers to vector areas

I did succeed ultimately in creating a model that did these steps. I ran into a number of issues, but am not sure which are bugs and which are misunderstandings of how this is supposed to work. So I’ll go through them step by step. Here is what I learned in the process and the questions I encountered.

**Data Item"

Adding data item works fine. But data items added with this button cannot be linked with GRASS command items AFAICT. You must enter a data item in the command module dialog and a data item is automatically generated. So what is the point of this button? The mouseover calls this a data item. If it is only a map, then it is probably easier for GRASS users to understand if the mouseover text said “add map to model”. If it includes other kinds of data, I do not know how to indicate this.

Command Item

Mouseover to this item is “add action (GRASS module) to model”. It would probably make more sense to GRASS users if it said “add GRASS command to model”

Once an action item has been added to the model, it opens a dialog that lets the user select a GRASS command. A GRASS command typed in command text window not recognized; the command must be selected from the combo box. The command is then written to the command window.

GRASS commands are duplicated in the combo box.

After selecting a command in the combox box and clicking OK, nothing shows up in modeler canvas.

It turns out that after selecting the command from the combobox, it is necessary to then place the cursor in the command window, after the command, and press return. But the command must first be selected from the combobox. Why have the command window at all if they must be picked from the combobox?

Clicking OK in command dialog does not make it go away. It is necessary to press the close button. The OK button should kill this dialog.

What does “parmeterized in model” mean? When it is checked, I can see no way of connecting a data item to a command item. And I can find no place to define a dummy data item into which data can be place when the model is run. There is a section on variable controls, but it isn’t clear how to use these.

Modeler Window

Input from an existing map shows up a oval with arrow to command module. But module taking output from another module doesn’t show any graphical connection. There is no way to draw a graphical connection from one component of a model another component.

After unchecking the parameterized boxes in an action item, and clicking the connector button a couple times, the modules become linked with arrows. But the arrows go the wrong way. that is, in my model, data from v.to.rast feeds into r.buffer and data from r.buffer feeds into r.to.vect. But the arrows are from r.to.vect to r.buffer to v.to.rast.

AFAICT, at the button with the mouseover text of “define relation between data and action items” does nothing graphical. It works sporadically, and when it does, it seems to generate data ovals and connect them to the command boxes. But these must be defined in the command item/grass module AFAICT.

I did not yet try saving a model, reloading it, or exporting it to Python.

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

Hi,

2011/9/3 Michael Barton <Michael.Barton@asu.edu>:

Here are some results of my experiments with the graphical modeler in GRASS 6.5. Question: is the code the same for the modeler across all GRASS versions currently?

yes, the code should be same in all three active branches (as it's
marked as experimental).

I tried to create a model that did the following steps using the Spearfish
demo data set:
1) convert the vector streams map to raster
2) run r.buffer on the rasterized streams
3) convert the raster buffers to vector areas

Here is workflow for this model for which the modeler has been
designed by me (~ 1 year ago) [1].

**Data Item"

Adding data item works fine. But data items added with this button cannot be
linked with GRASS command items AFAICT. You must enter a data item in the
command module dialog and a data item is automatically generated. So what is
the point of this button? The mouseover calls this a data item. If it is

Some users start the model with an action (as me) other with a data.
The modeler should satisfy all users :wink: I fixed data item first
approach some weeks ago [2].

only a map, then it is probably easier for GRASS users to understand if the
mouseover text said "add map to model". If it includes other kinds of data,
I do not know how to indicate this.

It can be anything you can list by g.list, so probably it should be
called "element" ?

**Command Item**

Mouseover to this item is "add action (GRASS module) to model". It would
probably make more sense to GRASS users if it said "add GRASS command to
model"

The users, what do you think?

Once an action item has been added to the model, it opens a dialog that lets
the user select a GRASS command. A GRASS command typed in command text
window not recognized; the command must be selected from the combo box. The
command is then written to the command window.

Fixed in SVN.

GRASS commands are duplicated in the combo box.

Not all, anyway now fixed in SVN.

After selecting a command in the combox box and clicking OK, nothing shows
up in modeler canvas.

Unable to reproduce it.

* select command from combobox -> command is shown in command window
* click on 'OK' -> action is added to the model, properties dialog shown

It turns out that after selecting the command from the combobox, it is
necessary to then place the cursor in the command window, after the command,
and press return. But the command must first be selected from the combobox.
Why have the command window at all if they must be picked from the combobox?

Clicking OK in command dialog does not make it go away. It is necessary to
press the close button. The OK button should kill this dialog.

What does "parmeterized in model" mean? When it is checked, I can see no way
of connecting a data item to a command item. And I can find no place to
define a dummy data item into which data can be place when the model is run.
There is a section on variable controls, but it isn't clear how to use
these.

See [3]

Defining relation manually also fixed in SVN [4].

[...]

Martin

[1] http://www.youtube.com/watch?v=NeWavDSOhQk&feature=player_embedded
[2] http://www.youtube.com/watch?v=lzlpfXNbjuA&feature=player_embedded
[3] http://www.youtube.com/watch?v=j2UfmXbzvpg&feature=player_embedded
[4] http://www.youtube.com/watch?v=Qxi_TblVYa0&feature=player_embedded

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

Hi,

2011/9/3 Michael Barton <Michael.Barton@asu.edu>:

[...]

Input from an existing map shows up a oval with arrow to command module. But
module taking output from another module doesn't show any graphical
connection. There is no way to draw a graphical connection from one
component of a model another component.

The first module produces output (data), so

module (action) ->data (eg. raster map) -> module (action)

AFAICT, at the button with the mouseover text of "define relation between
data and action items" does nothing graphical. It works sporadically, and
when it does, it seems to generate data ovals and connect them to the
command boxes. But these must be defined in the command item/grass module
AFAICT.

It should add connection between items (line with arrow). At the
beginning the modeler has not been design to define relations
manually, they should be updated based on action parameters you enter.
Speaking about manual definition of relation you can expect some bugs,
please report them on trac (with reproducible examples).

Martin

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

Thanks for the enhancements. I'll test. Are these backported to all versions or just in 6.5 for now?

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Sep 6, 2011, at 3:21 AM, Martin Landa wrote:

Hi,

2011/9/3 Michael Barton <Michael.Barton@asu.edu>:

[...]

Input from an existing map shows up a oval with arrow to command module. But
module taking output from another module doesn't show any graphical
connection. There is no way to draw a graphical connection from one
component of a model another component.

The first module produces output (data), so

module (action) ->data (eg. raster map) -> module (action)

AFAICT, at the button with the mouseover text of "define relation between
data and action items" does nothing graphical. It works sporadically, and
when it does, it seems to generate data ovals and connect them to the
command boxes. But these must be defined in the command item/grass module
AFAICT.

It should add connection between items (line with arrow). At the
beginning the modeler has not been design to define relations
manually, they should be updated based on action parameters you enter.
Speaking about manual definition of relation you can expect some bugs,
please report them on trac (with reproducible examples).

Martin

--
Martin Landa <landa.martin gmail.com> * Studijní program Geodézie a kartografie – GeoWikiCZ

2011/9/6 Michael Barton <Michael.Barton@asu.edu>:

Thanks for the enhancements. I'll test. Are these backported to all versions or just in 6.5 for now?

everything is done in trunk and backported to devbr6 and relbr64 (it's
marked as experimental prototype).

Martin

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

A lot of things work much better on this. Thanks.

Here is a problem that I found with the newest version.

1) add a data object and pick a map or other element
2) select that data object and try to change the map/element

Raises the following error:

Traceback (most recent call last):
  File "/Applications/GRASS/GRASS-6.4.app/Contents/MacOS/etc
/wxpython/gui_modules/gselect.py", line 218, in OnPopup

self.seltree.EnsureVisible(match)
  File "/Applications/GRASS/GRASS-6.4.app/Contents/MacOS/etc
/python/wx/_controls.py", line 5530, in EnsureVisible

return _controls_.TreeCtrl_EnsureVisible(*args, **kwargs)
wx._core
.
PyAssertionError
:
C++ assertion "item.IsOk()" failed at /BUILD/wxPython-
src-2.8.12.0/src/generic/treectlg.cpp(2107) in
EnsureVisible(): invalid tree item

I'm also getting an error if I set parameterization and run the model, but it may be related to this one.

A different issue is that you should be able to leave blank a field that you parameterize in the model. But this raises several error messages--although by ignoring them, you can go ahead and run the model and select the parameterized item.

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Sep 6, 2011, at 11:54 AM, Martin Landa wrote:

2011/9/6 Michael Barton <Michael.Barton@asu.edu>:

Thanks for the enhancements. I'll test. Are these backported to all versions or just in 6.5 for now?

everything is done in trunk and backported to devbr6 and relbr64 (it's
marked as experimental prototype).

Martin

--
Martin Landa <landa.martin gmail.com> * Studijní program Geodézie a kartografie – GeoWikiCZ