[GRASS-user] Pygrass reading raster issue
Moritz Lennert
mlennert at club.worldonline.be
Mon Mar 14 06:45:41 PDT 2016
Le Mon, 14 Mar 2016 13:45:42 +0100,
Lorenzo Bottaccioli <lorenzo.bottaccioli at gmail.com> a écrit :
> Hi all,
>
> I'm tring to read a raster map from my grassData.
>
> I'm using this code
>
> import os
> import grass.script.setup as gsetup
> from grass.pygrass import raster
>
> gisbase = os.environ['GISBASE']
> gisdbase = os.path.abspath("/home/myuser/grassData")
> location = 'mylocation'
> mapset = 'mymapset'
> gsetup.init(gisbase, gisdbase, location, mapset)
>
> elev=raster.RasterRow('elevation')
> elev.open()
> for row in elev:
> print row
>
> But I get all values with nan, where is the error?
>
> If I do `elev.info()` I get this result
>
> elevation@
> rows: 4502
> cols: 5554
> north: 45.0743663458 south: 45.0500262069 nsres:5.40651685671e-06
> east: 7.67457811722 west: 7.6445503225 ewres:5.40651687473e-06
> range: 233.050003052, 310.049987793
> proj: 3
>
Check your computational region settings.
Moritz
More information about the grass-user
mailing list