[GRASS-dev] Re: [GRASS-user] GRASS6.3 on Windows

This is one of the few items on the Windows native GRASS that doesn't work
(apparently some infuriating problems with attribute databases too).

From posts a couple months back, it seems that it DID work in this version

early on and then stopped working. This suggests that there should be a way
to get it running again.

I am planning to use GRASS in a spatial tech class Spring semester and hope
this can be resolved.

Michael

On 8/7/07 2:17 AM, "RAVI KUMAR" <ravivundavalli@yahoo.com> wrote:

Hi All,
been trying the latest GRASS 6.3 on windows O/S.

NVIZ on D.M gives error
'couldnt execute NVIZ'

NVIZ on map display just doesnt work..
Nothing happens when you click on it.

Ravi Kumar

______________________________________________________________________________
______
Choose the right car based on your needs. Check out Yahoo! Autos new Car
Finder tool.
http://autos.yahoo.com/carfinder/

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

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

> been trying the latest GRASS 6.3 on windows O/S.
>
> NVIZ on D.M gives error
> 'couldnt execute NVIZ'
>
> NVIZ on map display just doesnt work..
> Nothing happens when you click on it.

This is one of the few items on the Windows native GRASS that doesn't work
(apparently some infuriating problems with attribute databases too).

From posts a couple months back, it seems that it DID work in this version
early on and then stopped working. This suggests that there should be a way
to get it running again.

It definitely used to work natively on Windows, and I think that it
also worked natively on OSX.

ISTR a comment that it stopped around the time that Bob changed NVIZ
from being a self-contained C module to a combination of a script
($GIBASE/bin/nviz) and a modified wish ($GISBASE/etc/nviz2.2/nviz).

That may just be a rumour, though. It would be nice if someone[1]
could confirm this, by compiling versions before and after 2006-12-11
for native Windows.

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

Glynn Clements wrote:

> > been trying the latest GRASS 6.3 on windows O/S.
> >
> > NVIZ on D.M gives error
> > 'couldnt execute NVIZ'
> >
> > NVIZ on map display just doesnt work..
> > Nothing happens when you click on it.
>
> This is one of the few items on the Windows native GRASS that doesn't work
> (apparently some infuriating problems with attribute databases too).
>
> From posts a couple months back, it seems that it DID work in this version
> early on and then stopped working. This suggests that there should be a way
> to get it running again.

It definitely used to work natively on Windows, and I think that it
also worked natively on OSX.

ISTR a comment that it stopped around the time that Bob changed NVIZ
from being a self-contained C module to a combination of a script
($GIBASE/bin/nviz) and a modified wish ($GISBASE/etc/nviz2.2/nviz).

That may just be a rumour, though. It would be nice if someone[1]
could confirm this, by compiling versions before and after 2006-12-11
for native Windows.

Done that. Yep, it's the script; MSys strikes again.

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

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

Hot dog!!

Thanks a million.

Michael

On 8/7/07 12:20 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Glynn Clements wrote:

been trying the latest GRASS 6.3 on windows O/S.

NVIZ on D.M gives error
'couldnt execute NVIZ'

NVIZ on map display just doesnt work..
Nothing happens when you click on it.

This is one of the few items on the Windows native GRASS that doesn't work
(apparently some infuriating problems with attribute databases too).

From posts a couple months back, it seems that it DID work in this version
early on and then stopped working. This suggests that there should be a way
to get it running again.

It definitely used to work natively on Windows, and I think that it
also worked natively on OSX.

ISTR a comment that it stopped around the time that Bob changed NVIZ
from being a self-contained C module to a combination of a script
($GIBASE/bin/nviz) and a modified wish ($GISBASE/etc/nviz2.2/nviz).

That may just be a rumour, though. It would be nice if someone[1]
could confirm this, by compiling versions before and after 2006-12-11
for native Windows.

Done that. Yep, it's the script; MSys strikes again.

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Tue, 2007-08-07 at 20:20 +0100, Glynn Clements wrote:

Glynn Clements wrote:

> > > been trying the latest GRASS 6.3 on windows O/S.
> > >
> > > NVIZ on D.M gives error
> > > 'couldnt execute NVIZ'
> > >
> > > NVIZ on map display just doesnt work..
> > > Nothing happens when you click on it.
> >
> > This is one of the few items on the Windows native GRASS that doesn't work
> > (apparently some infuriating problems with attribute databases too).
> >
> > From posts a couple months back, it seems that it DID work in this version
> > early on and then stopped working. This suggests that there should be a way
> > to get it running again.
>
> It definitely used to work natively on Windows, and I think that it
> also worked natively on OSX.
>
> ISTR a comment that it stopped around the time that Bob changed NVIZ
> from being a self-contained C module to a combination of a script
> ($GIBASE/bin/nviz) and a modified wish ($GISBASE/etc/nviz2.2/nviz).
>
> That may just be a rumour, though. It would be nice if someone[1]
> could confirm this, by compiling versions before and after 2006-12-11
> for native Windows.

Done that. Yep, it's the script; MSys strikes again.

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

This implements one of the suggestion I made for Windows back on May 19,
2007 (Subj.: Nviz on native Windows). I guess no one had tested them??

The other suggestion was try directly running nviz2.2_script ....

Another way, which may be a better solution for windows is to edit the
nviz2.2_script file and replace "#!/nviz -f" with "#!
$GISBASE/etc/nviz2.2/nviz -f". You may need to enter the full path for
$GISBASE. After editing the file copy it to $GISBASE/bin/nviz
(overwriting the old nviz script). Make sure it is executable. Run
nviz (formerly nviz2.2_script).

--
Bob

Bob Covill wrote:

> I've added an nviz.bat script for use on Windows; I've also fixed the
> Makefile to ensure that the binary gets the .exe extension.

This implements one of the suggestion I made for Windows back on May 19,
2007 (Subj.: Nviz on native Windows). I guess no one had tested them??

Presumably not.

This has always been the biggest problem with the Windows and MacOSX
ports. Most developers don't use those platforms, and most of the
people who do use them aren't developers.

The other suggestion was try directly running nviz2.2_script ....
> Another way, which may be a better solution for windows is to edit the
> nviz2.2_script file and replace "#!/nviz -f" with "#!
> $GISBASE/etc/nviz2.2/nviz -f". You may need to enter the full path for
> $GISBASE. After editing the file copy it to $GISBASE/bin/nviz
> (overwriting the old nviz script). Make sure it is executable. Run
> nviz (formerly nviz2.2_script).

Anything involving "#!" won't work natively on Windows.

Also, anything involving MSys' bash is asking for trouble. Real
portability will likely only be obtained by scrapping the use of
Bourne shell in favour of e.g. Python.

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

Thanks Glynn,

I won't be able to provide new binaries before Aug. 20, so whoever wants
to try this before will have to compile themselves.

Moritz

On Tue, August 7, 2007 21:23, Michael Barton wrote:

Hot dog!!

Thanks a million.

Michael

On 8/7/07 12:20 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Glynn Clements wrote:

been trying the latest GRASS 6.3 on windows O/S.

NVIZ on D.M gives error
'couldnt execute NVIZ'

NVIZ on map display just doesnt work..
Nothing happens when you click on it.

This is one of the few items on the Windows native GRASS that doesn't
work
(apparently some infuriating problems with attribute databases too).

From posts a couple months back, it seems that it DID work in this
version
early on and then stopped working. This suggests that there should be
a way
to get it running again.

It definitely used to work natively on Windows, and I think that it
also worked natively on OSX.

ISTR a comment that it stopped around the time that Bob changed NVIZ
from being a self-contained C module to a combination of a script
($GIBASE/bin/nviz) and a modified wish ($GISBASE/etc/nviz2.2/nviz).

That may just be a rumour, though. It would be nice if someone[1]
could confirm this, by compiling versions before and after 2006-12-11
for native Windows.

Done that. Yep, it's the script; MSys strikes again.

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Moritz Lennert wrote:

>> I've added an nviz.bat script for use on Windows; I've also fixed the
>> Makefile to ensure that the binary gets the .exe extension.

I won't be able to provide new binaries before Aug. 20, so whoever wants
to try this before will have to compile themselves.

Nothing needs to be compiled. The only changes required are to add the
the nviz.bat script to the $GISBASE/bin directory and rename the nviz
binary (in $GISBASE/etc/nviz2.2) to nviz.exe.

The nviz.bat script is just:

"%GISBASE%\etc\nviz2.2\nviz.exe" -f "%GISBASE%\etc\nviz2.2\scripts\nviz2.2_script" %*

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

On Tue, 7 Aug 2007, Glynn Clements wrote:

Done that. Yep, it's the script; MSys strikes again.

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

That's excellent - I can confirm that it works again for me too. Somehow I thought there was something else - I tried reverting to the way it was before but couldn't get it working again. But didn't think of adding a separate script start for Windows.

I found another issue with the use of the cat command in part of an NVIZ Tcl script which I've also fixed, and it seems to be working well now. Grepping for "exec" in the other scripts I see a few more hackish-looking things that will need to be fixed to get all the NVIZ functionality working on Windows though.

Paul

On Wed, August 8, 2007 20:49, Paul Kelly wrote:

On Tue, 7 Aug 2007, Glynn Clements wrote:

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

That's excellent - I can confirm that it works again for me too. Somehow I
thought there was something else - I tried reverting to the way it was
before but couldn't get it working again. But didn't think of adding a
separate script start for Windows.

I found another issue with the use of the cat command in part of an NVIZ
Tcl script which I've also fixed, and it seems to be working well now.
Grepping for "exec" in the other scripts I see a few more hackish-looking
things that will need to be fixed to get all the NVIZ functionality
working on Windows though.

Just checked out latest CVS and recompiled, and now I get the following
when I try to launch nviz from the menu (File -> 3D Rendering -> NVIZ):

child killed: SIGABRT
    while executing
"exec -- $program --tcltk"
    (procedure "run_ui" line 6)
    invoked from within
"run_ui $cmd"
    (procedure "execute" line 3)
    invoked from within
"execute nviz "
    (menu invoke)

When I display the spearfish DEM in a display window and then click on the
nviz button of that window, nothing happens. No error messages, nothing
except for a brief appearance of r.info.exe in the Windows task manager.

Moritz

On Mon, 20 Aug 2007, Moritz Lennert wrote:

On Wed, August 8, 2007 20:49, Paul Kelly wrote:

On Tue, 7 Aug 2007, Glynn Clements wrote:

I've added an nviz.bat script for use on Windows; I've also fixed the
Makefile to ensure that the binary gets the .exe extension.

That's excellent - I can confirm that it works again for me too. Somehow I
thought there was something else - I tried reverting to the way it was
before but couldn't get it working again. But didn't think of adding a
separate script start for Windows.

I found another issue with the use of the cat command in part of an NVIZ
Tcl script which I've also fixed, and it seems to be working well now.
Grepping for "exec" in the other scripts I see a few more hackish-looking
things that will need to be fixed to get all the NVIZ functionality
working on Windows though.

Just checked out latest CVS and recompiled, and now I get the following
when I try to launch nviz from the menu (File -> 3D Rendering -> NVIZ):

child killed: SIGABRT
   while executing
"exec -- $program --tcltk"
   (procedure "run_ui" line 6)
   invoked from within
"run_ui $cmd"
   (procedure "execute" line 3)
   invoked from within
"execute nviz "
   (menu invoke)

When I display the spearfish DEM in a display window and then click on the
nviz button of that window, nothing happens. No error messages, nothing
except for a brief appearance of r.info.exe in the Windows task manager.

Hello Moritz,
Works for me starting it both those ways, and also from command-line. I even tried make distclean and compiling from scratch in case there was something I'd manually fixed that kept it working on my system. So I don't know what could be up with yours. Maybe you have an old nviz.exe lying around in your PATH somewhere that is getting picked up when the GUI runs "nviz", instead of Glynn's new nviz.bat?

A couple of side-notes though:
1) In general the GUI is terrible at catching and reporting errors from modules it calls in the background and this leads to cryptic error messages or nothing happening all over the place. IMHO it is a really pervasive problem that definitely needs fixed in the next GUI. Hopefully it already is there (ISTR discussions about every call to a GRASS module going through some other function where the error trapping could presumably be added, to avoid code repetition).

2) When the displayed layers start up in NVIZ the colour of the displayed vector map isn't preserved. I'm guessing this is because it can't be specified on the command-line, but perhaps the code that starts NVIZ using the displayed layers should write a temporary NVIZ state file and then start NVIZ with that file? I've no idea how complicated that would be to do though. E.g. might be better only focussing on it in the new GUI.

I would love the functionality of NVIZ (most of which is implemented using the gsurf library AIUI), to be available from the command-line as well as through the Tcl/Tk interface. Would be cool to be able to generate 3-D images with specified observer location and attitude and so on from a shell script (or scripting language of your choice), rather than having to do it with Tcl scripting in NVIZ.

Paul

Hello Moritz,
Works for me starting it both those ways, and also from command-line. I
even tried make distclean and compiling from scratch in case there was
something I'd manually fixed that kept it working on my system. So I don't
know what could be up with yours. Maybe you have an old nviz.exe lying
around in your PATH somewhere that is getting picked up when the GUI runs
"nviz", instead of Glynn's new nviz.bat?

A couple of side-notes though:
1) In general the GUI is terrible at catching and reporting errors from
modules it calls in the background and this leads to cryptic error
messages or nothing happening all over the place. IMHO it is a really
pervasive problem that definitely needs fixed in the next GUI. Hopefully
it already is there (ISTR discussions about every call to a GRASS module
going through some other function where the error trapping could
presumably be added, to avoid code repetition).

Actually, error trapping is pretty good in the GUI now, except for NVIZ (but
which doesn't run much in the way of GRASS commands anyway). There are traps
around all (or perhaps nearly all) GRASS commands that run through the GUI
that will kick out any GRASS errors to the terminal or a message box.

However, on top of that are GUI errors. TclTk does a pretty good job of
reporting these, but they only make sense if you understand TclTk of course.
At least they are not obscure error codes.

2) When the displayed layers start up in NVIZ the colour of the displayed
vector map isn't preserved. I'm guessing this is because it can't be
specified on the command-line, but perhaps the code that starts NVIZ using
the displayed layers should write a temporary NVIZ state file and then
start NVIZ with that file? I've no idea how complicated that would be to
do though. E.g. might be better only focussing on it in the new GUI.

This probably complicated, but I really don't know as I don't understand
these files. Probably Bob or Helena does.

I would love the functionality of NVIZ (most of which is implemented using
the gsurf library AIUI), to be available from the command-line as well as
through the Tcl/Tk interface. Would be cool to be able to generate 3-D
images with specified observer location and attitude and so on from a
shell script (or scripting language of your choice), rather than having to
do it with Tcl scripting in NVIZ.

Issuing commands to have an output file created is not a problem. Getting an
image to *display somewhere* is the problem. NVIZ is a display/visualization
application which displays images in a TclTk/OpenGL canvas. That is how the
rest of the GUI works now (i.e., a TclTk canvas, albeit without openGL). To
display something in a TclTk canvas requires TclTk scripting. A wxPython
canvas requires wxPython scripting; a Java canvas needs Java scripting, and
so on. The only reason it appears that you can type a command and have it
display in GRASS outside of this is that GRASS also has display drivers that
can send an image to an old-style xterminal (textronic emulation I think).
In other words, displaying an image in a "GRASS canvas" requires GRASS
scripting.

You could write code that would let you type in stuff and translate that
into TclTk script commands needed to display the output in a TclTk canvas.
We've done with with wxPython, where it's a bit easier to do, but still
something of a chore (since modern GUI's usually assume that you want to use
a GUI to display something in their canvases).

In fact it is possible to write NVIZ script code that can do pretty much
what you want. I don't know how to do it, but you should be able type script
commands to control the visualization and open NVIZ with this script (Maybe
you can even cat these into NVIZ in a *nix system--though I don't know if
this is possible or not).

This is what d.nviz does--or would do if it wasn't broken.

Michael

Paul

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Tue, 21 Aug 2007, Michael Barton wrote:

Hello Moritz,
Works for me starting it both those ways, and also from command-line. I
even tried make distclean and compiling from scratch in case there was
something I'd manually fixed that kept it working on my system. So I don't
know what could be up with yours. Maybe you have an old nviz.exe lying
around in your PATH somewhere that is getting picked up when the GUI runs
"nviz", instead of Glynn's new nviz.bat?

A couple of side-notes though:
1) In general the GUI is terrible at catching and reporting errors from
modules it calls in the background and this leads to cryptic error
messages or nothing happening all over the place. IMHO it is a really
pervasive problem that definitely needs fixed in the next GUI. Hopefully
it already is there (ISTR discussions about every call to a GRASS module
going through some other function where the error trapping could
presumably be added, to avoid code repetition).

Actually, error trapping is pretty good in the GUI now, except for NVIZ (but
which doesn't run much in the way of GRASS commands anyway). There are traps

Well maybe I was being a bit overly dramatic, but running
  grep "exec " *.tcl | grep -v catch | wc -l
in the gis.m directory still reveals 72 lines where exec is used without a
corresponding catch. Not very scientific and perhaps not important in most
cases - but if a single command (be it a GRASS module or system command)
is not available or not working for some reason it could really make the
difference between somebody tearing their hair out for a day or finding the source of a problem quickly.

around all (or perhaps nearly all) GRASS commands that run through the GUI
that will kick out any GRASS errors to the terminal or a message box.

Note that I'm not talking here about "expected" errors that come from bad user data or some kind of error that's handled by G_fatal_error() or whatever inside a GRASS command - I'm thinking more of unexpected errors caused perhaps by a library not being installed properly or files being corrupted on the user's system. Perhaps it's not a big deal right now and perhaps Python will make it much easier to do than Tcl or even do it automatically.

[...]

2) When the displayed layers start up in NVIZ the colour of the displayed
vector map isn't preserved. I'm guessing this is because it can't be
specified on the command-line, but perhaps the code that starts NVIZ using
the displayed layers should write a temporary NVIZ state file and then
start NVIZ with that file? I've no idea how complicated that would be to
do though. E.g. might be better only focussing on it in the new GUI.

This probably complicated, but I really don't know as I don't understand
these files. Probably Bob or Helena does.

I had a quick look and they're straightforward enough as they correspond directly with the widgets in the panels in NVIZ. But could do with much better documentation. And not worth working on either seeing we're looking to get rid of NVIZ and replace it with a better interface to the gsurf library.

I would love the functionality of NVIZ (most of which is implemented using
the gsurf library AIUI), to be available from the command-line as well as
through the Tcl/Tk interface. Would be cool to be able to generate 3-D
images with specified observer location and attitude and so on from a
shell script (or scripting language of your choice), rather than having to
do it with Tcl scripting in NVIZ.

Issuing commands to have an output file created is not a problem. Getting an
image to *display somewhere* is the problem. NVIZ is a display/visualization
application which displays images in a TclTk/OpenGL canvas. That is how the
rest of the GUI works now (i.e., a TclTk canvas, albeit without openGL). To
display something in a TclTk canvas requires TclTk scripting. A wxPython
canvas requires wxPython scripting; a Java canvas needs Java scripting, and
so on. The only reason it appears that you can type a command and have it
display in GRASS outside of this is that GRASS also has display drivers that
can send an image to an old-style xterminal (textronic emulation I think).
In other words, displaying an image in a "GRASS canvas" requires GRASS
scripting.

You could write code that would let you type in stuff and translate that
into TclTk script commands needed to display the output in a TclTk canvas.
We've done with with wxPython, where it's a bit easier to do, but still
something of a chore (since modern GUI's usually assume that you want to use
a GUI to display something in their canvases).

In fact it is possible to write NVIZ script code that can do pretty much
what you want. I don't know how to do it, but you should be able type script
commands to control the visualization and open NVIZ with this script (Maybe
you can even cat these into NVIZ in a *nix system--though I don't know if
this is possible or not).

What I was getting at is that you don't have to use NVIZ and/or Tcl/Tk to create 3-D views in GRASS. NVIZ is just a Tcl/Tk interface to the gsurf library (lib/ogsf) which is written in C. So my idea was to write some new C modules that link against libgrass_ogsf and duplicate the functionality of NVIZ but in a much more easily scriptable way. I'll keep quiet about it again though unless I actually get time to see how easy it is to do, as I really am not too sure how much work it would be.

Paul

This sounds like it would be really nice. My dream is to find a way to
'seamlessly' (overused buzzword, but appropriate here) integrate 2D views
with 2.5-3D views in the GRASS display system, so that it is just another
way to look at the same geospatial data rather than needing to launch a new
module.

Please keep thinking about it.

Michael

On 8/22/07 4:22 AM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

What I was getting at is that you don't have to use NVIZ and/or Tcl/Tk to
create 3-D views in GRASS. NVIZ is just a Tcl/Tk interface to the gsurf
library (lib/ogsf) which is written in C. So my idea was to write some new
C modules that link against libgrass_ogsf and duplicate the functionality
of NVIZ but in a much more easily scriptable way. I'll keep quiet about it
again though unless I actually get time to see how easy it is to do, as I
really am not too sure how much work it would be.

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

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 8/22/07 4:22 AM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

Well maybe I was being a bit overly dramatic, but running
  grep "exec " *.tcl | grep -v catch | wc -l
in the gis.m directory still reveals 72 lines where exec is used without a
corresponding catch. Not very scientific and perhaps not important in most
cases - but if a single command (be it a GRASS module or system command)
is not available or not working for some reason it could really make the
difference between somebody tearing their hair out for a day or finding
the source of a problem quickly.

Thanks for the analysis Paul. I'm wondering where all these are? I'll try to
re-run it and see. You are right about the difficulty of trapping the other
kind of errors though. The fact that they are often a couple levels down
from the GUI error traps, and may not generate particularly intelligent
stderr messages in the first place makes this especially hard. We need some
help with this.

Michael

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

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Paul Kelly wrote:

>> Works for me starting it both those ways, and also from command-line. I
>> even tried make distclean and compiling from scratch in case there was
>> something I'd manually fixed that kept it working on my system. So I don't
>> know what could be up with yours. Maybe you have an old nviz.exe lying
>> around in your PATH somewhere that is getting picked up when the GUI runs
>> "nviz", instead of Glynn's new nviz.bat?
>>
>> A couple of side-notes though:
>> 1) In general the GUI is terrible at catching and reporting errors from
>> modules it calls in the background and this leads to cryptic error
>> messages or nothing happening all over the place. IMHO it is a really
>> pervasive problem that definitely needs fixed in the next GUI. Hopefully
>> it already is there (ISTR discussions about every call to a GRASS module
>> going through some other function where the error trapping could
>> presumably be added, to avoid code repetition).
>
> Actually, error trapping is pretty good in the GUI now, except for NVIZ (but
> which doesn't run much in the way of GRASS commands anyway). There are traps

Well maybe I was being a bit overly dramatic, but running
  grep "exec " *.tcl | grep -v catch | wc -l
in the gis.m directory still reveals 72 lines where exec is used without a
corresponding catch. Not very scientific and perhaps not important in most
cases - but if a single command (be it a GRASS module or system command)
is not available or not working for some reason it could really make the
difference between somebody tearing their hair out for a day or finding
the source of a problem quickly.

> around all (or perhaps nearly all) GRASS commands that run through the GUI
> that will kick out any GRASS errors to the terminal or a message box.

Note that I'm not talking here about "expected" errors that come from bad
user data or some kind of error that's handled by G_fatal_error() or
whatever inside a GRASS command - I'm thinking more of unexpected errors
caused perhaps by a library not being installed properly or files being
corrupted on the user's system. Perhaps it's not a big deal right now and
perhaps Python will make it much easier to do than Tcl or even do it
automatically.

A catch only helps if you do something useful once you've caught the
exception.

If the caller is relying upon the procedure to return information, and
the inability to execute the program means that the information cannot
be obtained, then there isn't any practical alternative to allow the
exception to propagate up to the caller.

Sometimes it may be worthwhile catching an exception just so that you
can re-throw the exception with additional data. But in the case of
exec failing, the specific error (e.g. "unable to load shared library
libfoo.so") needs to be retained.

> In fact it is possible to write NVIZ script code that can do pretty much
> what you want. I don't know how to do it, but you should be able type script
> commands to control the visualization and open NVIZ with this script (Maybe
> you can even cat these into NVIZ in a *nix system--though I don't know if
> this is possible or not).

What I was getting at is that you don't have to use NVIZ and/or Tcl/Tk to
create 3-D views in GRASS. NVIZ is just a Tcl/Tk interface to the gsurf
library (lib/ogsf) which is written in C. So my idea was to write some new
C modules that link against libgrass_ogsf and duplicate the functionality
of NVIZ but in a much more easily scriptable way. I'll keep quiet about it
again though unless I actually get time to see how easy it is to do, as I
really am not too sure how much work it would be.

One thing to bear in mind is that you still need OpenGL. In practice,
this means that any such scripts need access to a GLX-capable X
server.

Also, you need to create the drawing "canvas" (a pBuffer or GLXPixmap
will suffice *if* the server supports them, otherwise you need to
create a window).

Alternatively, you can use an OSMesa context if you have OSMesa and
your libGL supports it (i.e. you have the standard X.org libGL, not
nVidia's version).

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

I've gone through and wrapped in catch statements all GRASS commands worth
wrapping (and probably some not worth it).

I also did a bit of cleanup to the help routines that I ran across.

I also added Carlos' get info buttons to the raster and vector layer panels.
These are quite handy.

There is a bug in v.what such that it kicks out the wrong stuff with its GUI
interface description. Only shows up from the GUI, but it would be nice if
it could be fixed.

Anything else GUI-wise broken and fixable that anyone has noticed?

Michael

On 8/22/07 4:22 AM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

A couple of side-notes though:
1) In general the GUI is terrible at catching and reporting errors from
modules it calls in the background and this leads to cryptic error
messages or nothing happening all over the place. IMHO it is a really
pervasive problem that definitely needs fixed in the next GUI. Hopefully
it already is there (ISTR discussions about every call to a GRASS module
going through some other function where the error trapping could
presumably be added, to avoid code repetition).

Actually, error trapping is pretty good in the GUI now, except for NVIZ (but
which doesn't run much in the way of GRASS commands anyway). There are traps

Well maybe I was being a bit overly dramatic, but running
  grep "exec " *.tcl | grep -v catch | wc -l
in the gis.m directory still reveals 72 lines where exec is used without a
corresponding catch. Not very scientific and perhaps not important in most
cases - but if a single command (be it a GRASS module or system command)
is not available or not working for some reason it could really make the
difference between somebody tearing their hair out for a day or finding
the source of a problem quickly.

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

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

Anything else GUI-wise broken and fixable that anyone has noticed?

Before 6.3.0 is released I'd like to finish off this wish:

Lat/Lon locations should format the Map Display statusbar x,y string into
45°59.9999'S 170°59.9999'W, not as decimal -45.999999 170.999999.

  http://wald.intevation.org/tracker/index.php?func=detail&aid=401

(I had previously committed code to reformat non-lat/lon coord text to a steady
'%.3f'; I just left lat/lon as '%.6f' or so but feel that's unfinished)

I have an idea or two how to do this slightly more efficiently than the
suggested code in the wish report (ie a few less lines in the mouse movement
update loop), but maybe the CPU overhead per mouse movement isn't as bad as I
expect and I'm stuck in a 4MHz 8086 mentality.

Feel free to have a stab at it if you like; I filed it as a wish as I was
having trouble finding the time to implement it, but didn't want it abandoned.
By the same token, I'd like it to be in 6.3.0 as that may be the last chance
for new TclTk features to be widely used.

There remains an unanswered question if "\xB0" produces a degree symbol on all
platforms.

test:
$ echo puts "90\xB0" | wish

Hamish

      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

On Thu, 2007-08-23 at 23:15 -0700, Michael Barton wrote:

I've gone through and wrapped in catch statements all GRASS commands worth
wrapping (and probably some not worth it).

I also did a bit of cleanup to the help routines that I ran across.

I also added Carlos' get info buttons to the raster and vector layer panels.
These are quite handy.

There is a bug in v.what such that it kicks out the wrong stuff with its GUI
interface description. Only shows up from the GUI, but it would be nice if
it could be fixed.

Anything else GUI-wise broken and fixable that anyone has noticed?

There still seems to be a nviz GUI redesign related problem
(it may be due to my set up, but Paul said
that he has a problem with Save state on his freshly checked GRASS CVS
too.)

I have compared nviz in 6.2.1 that had older interface and Save State
works there (at least to some extent) with 6.3 and the state
files are indeed different - in 6.3 the light data are missing and the
order of saved settings is different (the later may not matter).
But the real problem is that nviz in 6.3
cannot read the saved settings and I get the following error:

Diagnostic: wrong # args: should be "set varName ?newValue?" -- Load
procedure for panel main may not be defined
Diagnostic: invalid command name "Nviz_720 752_load" -- Load procedure
for panel 720 752 may not be defined
Diagnostic: invalid command name "Nviz_22.0_load" -- Load procedure for
panel 22.0 may not be defined
Diagnostic: invalid command name "Nviz_4.462_load" -- Load procedure
for panel 4.462 may not be defined
Diagnostic: invalid command name "Nviz_379.50_load" -- Load procedure
for panel 379.50 may not be defined
Diagnostic: invalid command name "Nviz_0.504 0.984_load" -- Load
procedure for panel 0.504 0.984 may not be defined
Diagnostic: invalid command name "Nviz_1_load" -- Load procedure for
panel 1 may not be defined
Diagnostic: invalid command name "Nviz_234.500000 234.500000
120.363991_load" -- Load procedure for panel 234.500000 234.500000
120.363991 may not be defined

There is also a problem with scripts - I don't think it is directly in
the file sequencing tool as I assume that it has not been touched, but
some of the recent changes must have affected handling of map names:

section of nviz script created by file sequencing tool

old that worked:

if {$iloop4 < 8} then {
  if {[lsearch {} $iloop4] == -1} then {
   if {[lsearch {} $iloop4] > -1} then {
    SendScriptLine "lappend NVIZ_BLANK_MAPS [ExtractMapID $mhandle6]"
   } else {
    SendScriptLine "$mhandle6 set_att color [lindex {hfl.sig100@indyfi
hfl.sig10@indyfi hfl.sig1@indyfi hfl.sig05@indyfi hfl.sig03@indyfi
hfl.sig01@indyfi hfl.sig005@indyfi hfl.sig001@indyfi} $iloop4]"
   }

new that does not work for obvious reasons (full path instead of
rastername@mapset) :

if {$iloop3 < 1} then {
  if {[lsearch {} $iloop3] == -1} then {
   if {[lsearch {} $iloop3] > -1} then {
    SendScriptLine "lappend NVIZ_BLANK_MAPS [ExtractMapID $mhandle4]"
   } else {
    SendScriptLine "$mhandle4 set_att topo [lindex
{/local/home/helena/grassdata07/nc_spm_05/user1/cell/elev_lidtopandef_1m@user1} $iloop3]"

The reason for the above problem seems to be that the save fields
function saves full path instead of name@mapset

/local/home/helena/limg/grassbook/dynsurf.state.nviz
2
Surface
Topography
surf*1185562518
1
/local/home/helena/grassdata07/nc_spm_05/user1/cell/elev_lidtopandef_1m@user1
Surface
Color
surf*1185562518
5
/local/home/helena/grassdata07/nc_spm_05/user1/cell/distr_2m.0418@user1
/local/home/helena/grassdata07/nc_spm_05/user1/cell/distr_2m.0438@user1
/local/home/helena/grassdata07/nc_spm_05/user1/cell/distr_2m.0458@user1
/local/home/helena/grassdata07/nc_spm_05/user1/cell/distr_2m.0478@user1
/local/home/helena/grassdata07/nc_spm_05/user1/cell/distr_2m.0498@user1

the old field file has just
distr_2m.0418@user1
distr_2m.0438@user1

I am hoping that the fix is not too complex,

Helena

Michael

On 8/22/07 4:22 AM, "Paul Kelly" <paul-grass@stjohnspoint.co.uk> wrote:

>>> A couple of side-notes though:
>>> 1) In general the GUI is terrible at catching and reporting errors from
>>> modules it calls in the background and this leads to cryptic error
>>> messages or nothing happening all over the place. IMHO it is a really
>>> pervasive problem that definitely needs fixed in the next GUI. Hopefully
>>> it already is there (ISTR discussions about every call to a GRASS module
>>> going through some other function where the error trapping could
>>> presumably be added, to avoid code repetition).
>>
>> Actually, error trapping is pretty good in the GUI now, except for NVIZ (but
>> which doesn't run much in the way of GRASS commands anyway). There are traps
>
> Well maybe I was being a bit overly dramatic, but running
> grep "exec " *.tcl | grep -v catch | wc -l
> in the gis.m directory still reveals 72 lines where exec is used without a
> corresponding catch. Not very scientific and perhaps not important in most
> cases - but if a single command (be it a GRASS module or system command)
> is not available or not working for some reason it could really make the
> difference between somebody tearing their hair out for a day or finding
> the source of a problem quickly.
>

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

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

On Fri, 24 Aug 2007 04:48:39 +0100, Glynn Clements <glynn@gclements.plus.com> wrote:

A catch only helps if you do something useful once you've caught the
exception.

If the caller is relying upon the procedure to return information, and
the inability to execute the program means that the information cannot
be obtained, then there isn't any practical alternative to allow the
exception to propagate up to the caller.

Sometimes it may be worthwhile catching an exception just so that you
can re-throw the exception with additional data. But in the case of
exec failing, the specific error (e.g. "unable to load shared library
libfoo.so") needs to be retained.

Yes sorry I wasn't clear = I meant keeping the stderr output as well as catching the error, and then something along the lines of displaying it in a pop-up dialog to the user - if the program just failed then a pop-up dialog would say that but if there was also an informational error message it would be displayed in the pop-up and could be a valuable hint as to the source of the problem. I did a bit of that in the recent changes I made to the way g.proj was run in the background when creating a new location during the gis_set.tcl startup - that's where the idea was coming from.