[GRASS-user] grass.script.array

Hi List,

I guess the module ‘array’ in grass.script library doesn’t work properly in grass 6.5 but does in 7 .

    import grass.script.array as garray

    ....

    slope = garray.array()
    area = garray.array()

    slope.read('r_slope')
    area.read('r_area')

    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_subplot(1, 1, 1)
    ax.set_yscale('log')

    ax.set_xscale('log')

    plt.plot(area,slope,'ro')

In grass 6.5 I get:

Sorry, <f> is not a valid flag
Sorry, <bytes> is not a valid parameter

Sorry, <f> is not a valid flag
Sorry, <bytes> is not a valid parameter
Traceback (most recent call last):
  File "/home/madi/gis/grass6_devel/grass-6.5.svn/scripts/[r.drop.py](http://r.drop.py)", line 59, in <module>

    sys.exit(main())
  File "/home/madi/gis/grass6_devel/grass-6.5.svn/scripts/[r.drop.py](http://r.drop.py)", line 53, in main
    plt.plot(area,slope,'ro')

  File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 2141, in plot
    ret = ax.plot(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 3437, in plot

    self.autoscale_view(scalex=scalex, scaley=scaley)
  File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1624, in autoscale_view
    XL = self.xaxis.get_major_locator().view_limits(x0, x1)

  File "/usr/lib/pymodules/python2.6/matplotlib/ticker.py", line 1119, in view_limits
    if not is_decade(vmin,self._base): vmin = decade_down(vmin,self._base)

  File "/usr/lib/pymodules/python2.6/matplotlib/ticker.py", line 1030, in is_decade
    return lx==int(lx)
OverflowError: cannot convert float infinity to integer

In grass 7 it works. Did anyone experienced it?
Thanks,

Margherita

Margherita Di Leo wrote:

I guess the module 'array' in grass.script library doesn't work properly in
grass 6.5 but does in 7 .

It relies upon some changes which were made to r.{in,out}.bin in
7.0.

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