[GRASS-SVN] r72226 - grass-addons/grass7/raster/r.vif
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Feb 10 07:33:11 PST 2018
Author: pvanbosgeo
Date: 2018-02-10 07:33:11 -0800 (Sat, 10 Feb 2018)
New Revision: 72226
Modified:
grass-addons/grass7/raster/r.vif/r.vif.py
Log:
Patch from Stefan Blumentrath to solve issue temporary file handling in Windows
Modified: grass-addons/grass7/raster/r.vif/r.vif.py
===================================================================
--- grass-addons/grass7/raster/r.vif/r.vif.py 2018-02-09 19:06:04 UTC (rev 72225)
+++ grass-addons/grass7/raster/r.vif/r.vif.py 2018-02-10 15:33:11 UTC (rev 72226)
@@ -91,6 +91,7 @@
import sys
import math
import numpy as np
+from cStringIO import StringIO
import uuid
import tempfile
import atexit
@@ -145,15 +146,10 @@
gs.run_command("r.mask", raster=new_mask, quiet=True)
# Get the raster values at sample points
- tmpcov = tempfile.mkstemp()[1]
- with open(tmpcov, "w") as text_file:
- text_file.write(
- gs.read_command("r.stats", flags="1n", input=raster,
- quiet=True, separator="comma"))
+ tmpcov = StringIO(gs.read_command("r.stats", flags="1n", input=raster,
+ quiet=True, separator="comma").rstrip('\n'))
p = np.loadtxt(tmpcov, skiprows=0, delimiter=",")
- # Clean up
- os.remove(tmpcov)
if not n == "100%":
gs.run_command("r.mask", flags="r", quiet=True)
if exist_mask['fullname']:
More information about the grass-commit
mailing list