[GRASS-SVN] r41989 - grass-addons/LandDyn/r.fix.netchange.py
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Apr 22 14:45:01 EDT 2010
Author: isaacullah
Date: 2010-04-22 14:45:01 -0400 (Thu, 22 Apr 2010)
New Revision: 41989
Modified:
grass-addons/LandDyn/r.fix.netchange.py/r.fix.netchange.py
Log:
minor updates to r.fix.netchange.py
Modified: grass-addons/LandDyn/r.fix.netchange.py/r.fix.netchange.py
===================================================================
--- grass-addons/LandDyn/r.fix.netchange.py/r.fix.netchange.py 2010-04-22 18:42:29 UTC (rev 41988)
+++ grass-addons/LandDyn/r.fix.netchange.py/r.fix.netchange.py 2010-04-22 18:45:01 UTC (rev 41989)
@@ -103,7 +103,7 @@
grass_print ('Working on netchange map series, please stand by.....')
- tempfilename = tempfile.mktemp()
+ tempfilename = tempfile.NamedTemporaryFile()
nccolors = open(tempfilename, 'w')
nccolors.write('100% 0 0 100\n1 blue\n0.5 indigo\n0.01 green\n0 white\n-0.01 yellow\n-0.5 orange\n-1 red\n0% 150 0 50')
nccolors.close()
@@ -132,17 +132,18 @@
if iter == startnum:
mapone = initdem
+ elif pattern+'%i_elevation' % startnum in mapstring:
+ mapone = pattern+'%i_elevation' % last_iter
else:
- mapone = '%s%i' % (elevpattern, last_iter)
-
+ mapone = '%s%i' % (elevpattern, last_iter)
maptwo = '%s%i' % (elevpattern, iter)
outmap = '%snetchange_%s' % (pattern, iter)
grass_com('r.mapcalc "%s=%s - %s"' % (outmap, maptwo, mapone))
- grass_com('r.colors --quiet map=%s rules=%s' % (outmap, tempfilename))
+ grass_com('r.colors --quiet map=%s rules=%s' % (outmap, tempfilename.name))
- os.remove(tempfilename)
+ close(tempfilename)
grass_print('Netchange map series done!')
def accumulate_erdep(pattern, startnum, endnum):
@@ -229,8 +230,8 @@
out2dict('r.univar -g -e map=%s percentile=99' % tmpdep, '=', depostats)
grass_com('g.remove --quiet rast=%s,%s' % (tmperosion, tmpdep))
-
+
if iter == startnum:
txtout.write('Stats for erosion and deposition simulation for: %s\n\nYear,,Mean Erosion,Max Erosion,Min Erosion,99th Percentile Erosion,,Mean Deposition,Min Deposition,Max Deposition,99th Percentile Deposition,,Mean Soil Depth,Min Soil Depth,Max Soil Depth,99th Percentile Soil Depth\n' % prefix)
More information about the grass-commit
mailing list