[GRASS-dev] problem using pygrass

Luca Delucchi lucadeluge at gmail.com
Fri Feb 28 15:11:44 PST 2014


On 27 February 2014 22:06, Pietro <peter.zamb at gmail.com> wrote:
> Hi Javier,
>

Hi,

>
> yes, this bug should be fixed in (r59127), I've tried this code using
> the North Carolina mapset:
>
> from grass.pygrass.raster import RasterNumpy
> elev = RasterNumpy('elevation')
> elev.open()
> flt = elev.flatten()
> len(flt)
> elev.close()
>
> and it works, are you in Linux?
>

I confirm this.
I would also add that it if you want to save the map you have to use:

flt = pygrass.raster.RasterNumpy('elevation_flatten')
flt.open('w',mtype='FCELL')
flt = elev.flatten()
elev.close()
flt.close()

otherwise you obtain an error (segmentation fault)

-- 
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org


More information about the grass-dev mailing list