[GRASS-dev] pygrass: region do not align to raster

Hi all,

it's seems to me that Region.align() is not working in pygrass as expected.

region = Region()
print region.rows -> is 977
region.align(rast)
print region.rows -> should be 11682, but prints 977

Or do I overlooked anything? Thanks, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

2015-04-19 15:32 GMT+02:00 Martin Landa <landa.martin@gmail.com>:

region = Region()
print region.rows -> is 977
region.align(rast)
print region.rows -> should be 11682, but prints 977

Or do I overlooked anything? Thanks, Martin

ah, it's just align just to resolution, not bounds. My original
question: is how to read raster using RasterRow() using raster's
region not the current region?

Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

2015-04-19 15:37 GMT+02:00 Martin Landa <landa.martin@gmail.com>:

ah, it's just align just to resolution, not bounds. My original

but documentation claims: adjust region cells to cleanly align with
this raster map

Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi Martin,

On Sun, Apr 19, 2015 at 3:32 PM, Martin Landa <landa.martin@gmail.com> wrote:

it's seems to me that Region.align() is not working in pygrass as expected.

region = Region()
print region.rows -> is 977
region.align(rast)
print region.rows -> should be 11682, but prints 977

You are right, all the methods: align and zoom are wrong, because
their are calling the g.region module, that it is execute in an
external process and therefore does not affect the current one,
therefore they should be:
- removed or
- re-implemented to provide the same functionality remaining in the
same process or
- move the align and zoom functions from the g.region module to the
library link them with ctypes and call them from the method.

Pietro

Hi,

2015-04-19 15:40 GMT+02:00 Pietro <peter.zamb@gmail.com>:

You are right, all the methods: align and zoom are wrong, because
their are calling the g.region module, that it is execute in an
external process and therefore does not affect the current one,

yes, thanks for confirmation. Back to the original question, is there
any other way how to read raster from it's region and not from the
current computational region set by g.region? Thanks, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa