[GRASS-dev] pygrass numpy object int and float data

Ivan Marchesini ivan.marchesini at gmail.com
Thu Jun 27 02:03:31 PDT 2013


Hi,
I have a CELL (integer) layer.

If I write these lines:

map=raster.RasterNumpy("grassmap")
map.open()
map.close()

I obtain:

  File "./r.grow.dir.incl4.py", line 310, in <module>
    main()
  File "./r.grow.dir.incl4.py", line 133, in main
    visited.close()
  File
"/usr/local/grass-7.0.svn/etc/python/grass/pygrass/raster/__init__.py",
line 664, in close
    self._write()
  File
"/usr/local/grass-7.0.svn/etc/python/grass/pygrass/raster/__init__.py",
line 607, in _write
    self.tofile(self.filename)
ValueError: 160000 requested and 0 written


if i write:

map=raster.RasterNumpy("grassmap")
map.open()
map=map*1.0
map.close()

it works.


Do the numpy raster object is, by default, a float type?

what I miss?

Many thanks

Ivan



More information about the grass-dev mailing list