[GRASS-dev] grass, python, Pygrass
ivan.marchesini at gmail.com
Wed Jun 26 06:16:51 PDT 2013
thank you for your answer
> this is not your code right?
yes it is mine
it is supposed to be part of a larger code I'm developing
> > grass.run_command("v.to.rast", input=ocs, type="line", output="tmp_ocs", use="val", overwrite=True)
> > grass.mapcalc("$outmap = $a", a = dtm, outmap="demcut", overwrite = true)
> > grass.run_command("g.remove", rast="visitati")
> > np_ocs = raster.RasterNumpy("tmp_ocs")
> > np_ocs.open()
> > visited=np_ocs*0
> > visited.open()
> > for i in range(1,new.shape-1):
> > for j in range(1,new.shape-1):
> > if np_ocs[i,j] == 1:
> > visited[i,j] = 1
> > else:
> > visited[i,j] = 3
> > visited.name='visitati'
> > visited.close()
> > sys.exit("stop")
> > When I run it I obtain a lot of:
> > WARNING: rast=visitati,visitati: files could be the same, no rename
> > possible
> > I cannot understand where the warnings arise... and why..
> > can you help me??
> probably you have to add visited.overwrite = True before close your map
I have just tried something ad you have to believe me that I was really
surprised when I discovered that all depends on the fact that the
"visited.name='visitati'" row was indented using tab in place of 4
spaces. I had not indentation error (as I usually obtain) but the code
was running regularly (apart from the error)
concerning this problem I would ask (with the risk to be OT) which is
the best python editor to work with.
At the moment I'm working with Geany but I'm not so happy about that.
What a really miss is an editor that, hopefully, can suggest the methods
and the properties of an object during coding. I know that ipython is
good for this but it is not so good for saving the code as a grass
Many thanks for now...
More information about the grass-dev