[GRASS-dev] casting row buffer in memory
glynn at gclements.plus.com
Wed Oct 8 02:24:19 PDT 2014
> So even if I'm explicitly casting the result in the scaler function
> with dtype(...), the result is not properly casted, do you have an
> idea on how could I solve this problem?
This is a bug in pygrass:
$ r.info -g foo | fgrep datatype
Python 2.7.7 (default, Sep 26 2014, 00:18:15)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
> from grass.pygrass.raster import RasterRow
> out = RasterRow('foo', mode='w', mtype='DCELL', overwrite=True)
If a map with the chosen name already exists, its type is used in
place of the one specified.
Looking at the code for grass.pygrass.raster.RasterRow.open(), the
overall structure is rather flawed. It primarily considers whether the
map already exists, then secondarily considers the mode (r/w).
It should be the other way around.
Whether you're reading an existing map or creating a new map is
fundamental. Whether the map exists is secondary; whether it "ought"
to exist and what to do if it does/doesn't is entirely different
depending upon whether you're reading or writing.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev