[GRASS-dev] [GRASS GIS] #2616: grass.script.array cannot write raster
GRASS GIS
trac at osgeo.org
Sun Mar 8 23:46:23 PDT 2015
#2616: grass.script.array cannot write raster
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: critical | Milestone: 7.0.1
Component: Python | Version: svn-trunk
Keywords: array | Platform: All
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
Replying to [ticket:2616 annakrat]:
> It seems the r64426 (backported in r64614) broke writing the array.
> Tested [http://grass.osgeo.org/grass70/manuals/libpython/script.html
example] with 1.8.2 !NumPy, the temporary file disappears once calling
this line:
It appears that __del__ gets called on the original array instance for
every slice. Note that changing `map2d_1[y][x]=` to `map2d_1[y,x]=` (which
is to be preferred) avoids the issue, but there are situations where
slicing will be appropriate, so this needs to be dealt with.
The docstring for numpy.memmap says:
{{{
This subclass of ndarray has some unpleasant interactions with
some operations, because it doesn't quite fit properly as a subclass.
}}}
r64819 wraps the temporary file in an object, avoiding the need for a
__del__ method in the array/array3d class. This appears to solve the
issue.
r64820 fixes the examples to use multi-dimensional indexing rather than
slicing.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2616#comment:1>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list