[GRASS-user] r.walk output and garray

2013-07-02 Thread Pierric
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@PERMANENT, 
friction=mnt_l3_toulouse@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!
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] r.walk output and garray

2013-07-02 Thread Nikos Alexandris
Pierric wrote:

 Dear Grass community,

Salut Pierric :-)

 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

Just wild guessing: here is ^^^ a slash in the path-name. Is this valid in 
Windows?

Nikos

[rest deleted]
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] r.walk output and garray

2013-07-02 Thread Pierric
Hello,

In fact the line of code that is causing the error is 

a.read(cost_output) # a is a garray

At that moment it needs to create a temporary file but fails at building the 
correct path by putting slashes instead of back slashes (for windows) for his 
part. Isn't it a bug?  Is there a possibility to give it the correct path?

ERROR: Unable to create file 
C:\A_GRID\PM\Grass\GrassDB/Location_L3/PERMANENT/.tmp/29576.0

Thank you,
Pierric




- Mail original -
De : Nikos Alexandris n...@nikosalexandris.net
À : grass-user@lists.osgeo.org; Pierric pierr...@yahoo.com
Cc : 
Envoyé le : Mardi 2 juillet 2013 14h54
Objet : Re: [GRASS-user] r.walk output and garray

Pierric wrote:

 Dear Grass community,

Salut Pierric :-)

 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

Just wild guessing: here is ^^^ a slash in the path-name. Is this valid in 
Windows?

Nikos

[rest deleted]

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] r.walk output and garray

2013-07-02 Thread Hamish
Pierric:
  - 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

Nikos:
 Just wild guessing: here is ^^^ a slash in the path-name. Is this valid in 
 Windows?

Yeah I think it is valid in that context actually, even if it looks weird.

I'd check if the .tmp/ directory really exists and if you can create new files 
there by hand.


Hamish

ps- using PERMANENT as the day-to-day working mapset is not recommended.

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user