Opened 9 years ago
Closed 9 years ago
#2616 closed defect (fixed)
grass.script.array cannot write raster
| Reported by: | annakrat | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | 7.0.1 |
| Component: | Python | Version: | svn-trunk |
| Keywords: | array | Cc: | |
| CPU: | Unspecified | Platform: | All |
Description
It seems the r64426 (backported in r64614) broke writing the array. Tested example with 1.8.2 NumPy, the temporary file disappears once calling this line:
map2d_1[y][x] = y + x
# and then this fails
map2d_1.write(mapname="map2d_1", overwrite=True)
ERROR: Unable to open
</home/anna/grassdata/xyLocation/anna/.tmp/anna-laptop/12383.0>
Change History (3)
comment:1 by , 9 years ago
follow-up: 3 comment:2 by , 9 years ago
What is the state here? It appears that the aforementioned changes got backported.
Issue solved?
comment:3 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Replying to neteler:
What is the state here? It appears that the aforementioned changes got backported.
Issue solved?
I believe so.
Note:
See TracTickets
for help on using tickets.

Replying to annakrat:
It appears that del gets called on the original array instance for every slice. Note that changing
map2d_1[y][x]=tomap2d_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.