[GRASS-user] r.walk output and garray

Pierric pierric7 at yahoo.com
Tue Jul 2 05:20:06 PDT 2013


Dear Grass community,

I am trying to use r.walk from python and the output file seems to be created correctly at the end of the python run. 


However:

- while python is running I get the following error (but code keeps on running) :  ERROR: Unable to create file <C:\A_GRID\PM\Grass\GrassDB/Location_L3/PERMANENT/.tmp/1824.0>

- All values of the output raster seem to be equal to 0.0 when I try to access them through a Grass garray. But I open the raster in Grass GUI all, I can see raster values were correctly populated for the whole raster. I get a nice cost surface.



Here is the core of my code :  (coord is an array containing coordinates of point in the reference system of the current region)


    a = garray.array()

    

    grass.run_command("g.remove", rast=cost_output)
    grass.run_command("r.walk", elevation="mnt_l3_toulouse at PERMANENT", friction="mnt_l3_toulouse at PERMANENT", output=cost_output, coordinate=[p1[0],p1[1]],_lambda=0)
           
    a.read(cost_output)
    
    for p2 in coord:

        x = int((p2[0]-w)/ewres)
        y = int((n-p2[1])/nsres)

        print a[y,x]



Thanks in advance!


More information about the grass-user mailing list