[GRASS-dev] casting row buffer in memory
Pietro
peter.zamb at gmail.com
Wed Oct 8 05:23:40 PDT 2014
On Wed, Oct 8, 2014 at 11:24 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Pietro wrote:
>
>> 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
> datatype=CELL
> $ python
> 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)
> > out.mtype
> u'CELL'
>
> If a map with the chosen name already exists, its type is used in
> place of the one specified.
Thank you to find out this bug, I didn't noticed it.
> 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.
Right. Thank you for your code review!
I will try to fix this on the next days.
All the best.
Pietro
More information about the grass-dev
mailing list