[GRASS-user] temporary files of grass.script.array

Johannes Radinger johannesradinger at gmail.com
Tue Feb 3 05:51:31 PST 2015


Hi,

In GRASS 7 (RC1) python it is possible to export a raster map to an array
which can be used e.g. by Numpy.

For example:

import grass.script.array as garray
x1 = garray.array()
x1.read("my_raster")

It seems that this creates a temporary file in the .tmp folder of the
respective
location. I am not sure if this has been existing before, but these
temporary
files are not deleted after e.g. x1 is not used anymore (i.e. the
calculation of
the script finished). So do I need to manually (in the python script) close
that x1 so
that the associated temporary file gets deleted (and if yes how?)? Otherwise
when using this procedure to do numpy calculations in loops the tmp-files
pile up quite fast.

Of course I can empty the tmp folder after every loop, but I am not sure
if this is really the right way.

Any suggestions?

/Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150203/2eda5e0c/attachment.html>


More information about the grass-user mailing list