[GRASS-dev] pyGRASS find number of rows and columns

Sören Gebbert soerengebbert at googlemail.com
Mon Sep 16 02:43:47 PDT 2013


Hi Yann,
you can use the raster info-oject to access the raster specific region
information's:

ras = raster.RasterRow("Bla")
ras.info.rows

You don't need to open the map to gather the info.

Best regards
Soeren

2013/9/16 Yann Chemin <ychemin at gmail.com>:
> Hi,
> Could you help to get access to nrows and ncols for a map please?
>
> ---------------
> from grass.pygrass import raster
> #get nrows and ncols
> ras = raster.RasterRow(LP2NDVI[0])
> ras.open('r')
> nrows = ras.rows <= I must be wrong here...
> ncols = ras.cols
> ras.close()
>
>
>>>> AttributeError: 'RasterRow' object has no attribute 'rows'
>
> The file does exist: ras.exist() returns True
>
> Thanks,
> Yann
>
> --
> ----
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list