wxgrass: histogram and profile

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

wxgrass: histogram and profile

Markus Neteler-3
Hi

(thanks for the alphabetical order!). Another report:

# trying the histogram in LatLong, I get:

Traceback (most recent call last):
Traceback (most recent call last):
  File "/home/neteler/grassaddons/gui/gui_modules/histogram.py", line 374, in OnOptions
    menuform.GUI().parseCommand('d.histogram', gmpath,
AttributeError: GUI instance has no attribute 'parseCommand'

# trying profile on the same map
Traceback (most recent call last):
  File "/home/neteler/grassaddons/gui/gui_modules/profile.py", line 472, in CreateProfile
    self.DrawPlot()
  File "/home/neteler/grassaddons/gui/gui_modules/profile.py", line 492, in DrawPlot
    legend=' '+self.plegend1)
  File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py", line 224, in __init__
    PolyPoints.__init__(self, points, attr)
  File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py", line 124, in __init__
    self._points = _Numeric.array(points).astype(_Numeric.Float64)
ValueError: matrices are not aligned for copy
   

I get the profile error also on other maps.
Concerning the profile: It's not clear to me if I have to start with
the second icon from left. If so, it would be more intuitive to put
it to the left.

# concering distance measure:
I feel that the result in latlong is degree or so - could this be changed
to metric output (like d.measure does with G_begin_distance_calculations())?

thanks
Markus

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Martin Landa
Hi,

2007/5/30, Markus Neteler <[hidden email]>:

> # trying the histogram in LatLong, I get:
>
> Traceback (most recent call last):
> Traceback (most recent call last):
>   File "/home/neteler/grassaddons/gui/gui_modules/histogram.py", line 374, in OnOptions
>     menuform.GUI().parseCommand('d.histogram', gmpath,
> AttributeError: GUI instance has no attribute 'parseCommand'

should be fixed now.

Martin

--
Martin Landa <[hidden email]> * http://gama.fsv.cvut.cz/~landa *

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Michael Barton
In reply to this post by Markus Neteler-3
Thanks Markus. Some questions below.


On 5/30/07 9:24 AM, "Markus Neteler" <[hidden email]> wrote:

> Hi
>
> (thanks for the alphabetical order!). Another report:
>
> # trying the histogram in LatLong, I get:
>
> Traceback (most recent call last):
> Traceback (most recent call last):
>   File "/home/neteler/grassaddons/gui/gui_modules/histogram.py", line 374, in
> OnOptions
>     menuform.GUI().parseCommand('d.histogram', gmpath,
> AttributeError: GUI instance has no attribute 'parseCommand'

AFAICT, this kind of error should affect all maps equally, regardless of
whether they are latlon or not. Is this the case?

If it is JUST latlon, then this is a bogus error that is masking what is
really wrong and needs fixing.

Does d.histogram work with latlon maps?


>
> # trying profile on the same map
> Traceback (most recent call last):
>   File "/home/neteler/grassaddons/gui/gui_modules/profile.py", line 472, in
> CreateProfile
>     self.DrawPlot()
>   File "/home/neteler/grassaddons/gui/gui_modules/profile.py", line 492, in
> DrawPlot
>     legend=' '+self.plegend1)
>   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py",
> line 224, in __init__
>     PolyPoints.__init__(self, points, attr)
>   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py",
> line 124, in __init__
>     self._points = _Numeric.array(points).astype(_Numeric.Float64)
> ValueError: matrices are not aligned for copy
>    
>
> I get the profile error also on other maps.
> Concerning the profile: It's not clear to me if I have to start with
> the second icon from left. If so, it would be more intuitive to put
> it to the left.

Start with the one on the left and work your way to the right. This is a bit
different from the TclTk version in that you draw the transect first. There
are internal programming reasons for this.

Do you have numpy installed? Jachym reports that contrary to the docs, you
need numpy and not just numeric or numarray. I've reported this to the
wxPython bug tracker.

Do you get the error if you draw the transect first?

>
> # concering distance measure:
> I feel that the result in latlong is degree or so - could this be changed
> to metric output (like d.measure does with G_begin_distance_calculations())?

This is a very good idea. But how can we get distance in meters from the
map? Anyone?

Michael

>
> thanks
> Markus
>
>

__________________________________________
Michael Barton, Professor of Anthropology
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 

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Markus Neteler-3
On Mon, Jun 04, 2007 at 11:55:01AM -0700, Michael Barton wrote:

> Thanks Markus. Some questions below.
>
>
> On 5/30/07 9:24 AM, "Markus Neteler" <[hidden email]> wrote:
>
> > Hi
> >
> > (thanks for the alphabetical order!). Another report:
> >
> > # trying the histogram in LatLong, I get:
> >
> > Traceback (most recent call last):
> > Traceback (most recent call last):
> >   File "/home/neteler/grassaddons/gui/gui_modules/histogram.py", line 374, in
> > OnOptions
> >     menuform.GUI().parseCommand('d.histogram', gmpath,
> > AttributeError: GUI instance has no attribute 'parseCommand'
>
> AFAICT, this kind of error should affect all maps equally, regardless of
> whether they are latlon or not. Is this the case?
>
> If it is JUST latlon, then this is a bogus error that is masking what is
> really wrong and needs fixing.

AFAIK Martin has already fixed it.
 
> Does d.histogram work with latlon maps?

Yes.

> >
> > # trying profile on the same map
> > Traceback (most recent call last):
> >   File "/home/neteler/grassaddons/gui/gui_modules/profile.py", line 472, in
> > CreateProfile
> >     self.DrawPlot()
> >   File "/home/neteler/grassaddons/gui/gui_modules/profile.py", line 492, in
> > DrawPlot
> >     legend=' '+self.plegend1)
> >   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py",
> > line 224, in __init__
> >     PolyPoints.__init__(self, points, attr)
> >   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/lib/plot.py",
> > line 124, in __init__
> >     self._points = _Numeric.array(points).astype(_Numeric.Float64)
> > ValueError: matrices are not aligned for copy
> >    
> >
> > I get the profile error also on other maps.
> > Concerning the profile: It's not clear to me if I have to start with
> > the second icon from left. If so, it would be more intuitive to put
> > it to the left.
>
> Start with the one on the left and work your way to the right. This is a bit
> different from the TclTk version in that you draw the transect first. There
> are internal programming reasons for this.

Well, then it fails - doesn't find the map.
 
> Do you have numpy installed? Jachym reports that contrary to the docs, you
> need numpy and not just numeric or numarray. I've reported this to the
> wxPython bug tracker.

Yes, numpy is installed.

> Do you get the error if you draw the transect first?

I have to try again.

> > # concering distance measure:
> > I feel that the result in latlong is degree or so - could this be changed
> > to metric output (like d.measure does with G_begin_distance_calculations())?
>
> This is a very good idea. But how can we get distance in meters from the
> map? Anyone?

libgis offers such function (see d.histogram). Time to get the
SWIG interface working :)

Markus

 

> Michael
>
> >
> > thanks
> > Markus
> >
> >
>
> __________________________________________
> Michael Barton, Professor of Anthropology
> 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 
>

--
Markus Neteler  <neteler itc it>  http://mpa.itc.it/markus/
FBK-irst -  Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18        -       38050 Povo (Trento), Italy

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Michael Barton



On 6/4/07 12:13 PM, "Markus Neteler" <[hidden email]> wrote:

> libgis offers such function (see d.histogram). Time to get the
> SWIG interface working :)

>From what you and Hamish have said, I guess I'd agree. It would certainly be
handy to access some of these GRASS functions that have already been worked
out.

Let me know what happens if you select transect first with profile.

Michael

>
> Markus

__________________________________________
Michael Barton, Professor of Anthropology
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 

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Michael Barton
In reply to this post by Markus Neteler-3
Isaac just tried this on the newest version of GRASS 6.3 and wxgrass (from
today) on our FC6 box and it worked OK.

Michael


On 6/4/07 12:13 PM, "Markus Neteler" <[hidden email]> wrote:

>> Start with the one on the left and work your way to the right. This is a bit
>> different from the TclTk version in that you draw the transect first. There
>> are internal programming reasons for this.
>
> Well, then it fails - doesn't find the map.
>  
>> Do you have numpy installed? Jachym reports that contrary to the docs, you
>> need numpy and not just numeric or numarray. I've reported this to the
>> wxPython bug tracker.
>
> Yes, numpy is installed.
>
>> Do you get the error if you draw the transect first?
>
> I have to try again.

__________________________________________
Michael Barton, Professor of Anthropology
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 

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Glynn Clements
In reply to this post by Markus Neteler-3

Markus Neteler wrote:

> > > # concering distance measure:
> > > I feel that the result in latlong is degree or so - could this be changed
> > > to metric output (like d.measure does with G_begin_distance_calculations())?
> >
> > This is a very good idea. But how can we get distance in meters from the
> > map? Anyone?
>
> libgis offers such function (see d.histogram). Time to get the
> SWIG interface working :)

I would advise against using libgis (via SWIG) in the GUI. The design
of libgis is entirely unsuited to persistent applications.

For example:

1. G_begin_distance_calculations() obtains the projection using
G_projection().

2. G_projection() obtains the current window using G_get_set_window(),
and returns the projection field.

3. G_get_set_window() returns G__.window, after calling
G__init_window() to initialise it.

4. G__init_window() calls G_get_window() if the window isn't already
set. If it is set, it does nothing.

If the GUI changes locations while running, the distance functions
would continue using the original projection, unless you manually
reset G__.window. And you can't use G_get_window() to read the WIND
file etc, as that just returns G__.window once it has been set.

More generally, there are just too many variables which get
initialised once and cannot subsequently be reset. This isn't a
problem for normal modules, but it's a fundamental problem for a GUI.

--
Glynn Clements <[hidden email]>

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Michael Barton
Thanks for the detailed explanation. Is this a caution in general about
using libgis via SWIG or more about this specific kind of information?

Michael


On 6/5/07 7:56 AM, "Glynn Clements" <[hidden email]> wrote:

>
> Markus Neteler wrote:
>
>>>> # concering distance measure:
>>>> I feel that the result in latlong is degree or so - could this be changed
>>>> to metric output (like d.measure does with
>>>> G_begin_distance_calculations())?
>>>
>>> This is a very good idea. But how can we get distance in meters from the
>>> map? Anyone?
>>
>> libgis offers such function (see d.histogram). Time to get the
>> SWIG interface working :)
>
> I would advise against using libgis (via SWIG) in the GUI. The design
> of libgis is entirely unsuited to persistent applications.
>
> For example:
>
> 1. G_begin_distance_calculations() obtains the projection using
> G_projection().
>
> 2. G_projection() obtains the current window using G_get_set_window(),
> and returns the projection field.
>
> 3. G_get_set_window() returns G__.window, after calling
> G__init_window() to initialise it.
>
> 4. G__init_window() calls G_get_window() if the window isn't already
> set. If it is set, it does nothing.
>
> If the GUI changes locations while running, the distance functions
> would continue using the original projection, unless you manually
> reset G__.window. And you can't use G_get_window() to read the WIND
> file etc, as that just returns G__.window once it has been set.
>
> More generally, there are just too many variables which get
> initialised once and cannot subsequently be reset. This isn't a
> problem for normal modules, but it's a fundamental problem for a GUI.

__________________________________________
Michael Barton, Professor of Anthropology
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


_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui
Reply | Threaded
Open this post in threaded view
|

Re: wxgrass: histogram and profile

Glynn Clements

Michael Barton wrote:

> Thanks for the detailed explanation. Is this a caution in general about
> using libgis via SWIG or more about this specific kind of information?

It's a caution against using libgis in "applications", as opposed to
typical GRASS modules.

Apart from the problem with settings which cannot be changed after
startup, there's also the fact that many errors will terminate the
calling process (G_fatal_error()), and the likelihood of memory leaks.

--
Glynn Clements <[hidden email]>

_______________________________________________
grassgui mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassgui