[GRASS-SVN] r74302 - grass/trunk/scripts/i.pansharpen
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 25 03:17:11 PDT 2019
Author: cmbarton
Date: 2019-03-25 03:17:11 -0700 (Mon, 25 Mar 2019)
New Revision: 74302
Modified:
grass/trunk/scripts/i.pansharpen/i.pansharpen.py
Log:
improved cleanup and garbage collection
Modified: grass/trunk/scripts/i.pansharpen/i.pansharpen.py
===================================================================
--- grass/trunk/scripts/i.pansharpen/i.pansharpen.py 2019-03-24 06:11:29 UTC (rev 74301)
+++ grass/trunk/scripts/i.pansharpen/i.pansharpen.py 2019-03-25 10:17:11 UTC (rev 74302)
@@ -265,8 +265,11 @@
# Cleanup
grass.message(_("cleaning up temp files"))
- grass.run_command('g.remove', flags="f", type="raster",
- pattern="tmp%s*" % pid, quiet=True)
+ try:
+ grass.run_command('g.remove', flags="f", type="raster",
+ pattern="tmp%s*" % pid, quiet=True)
+ except:
+ ""
def brovey(pan, ms1, ms2, ms3, out, pid, sproc):
grass.verbose(_("Using Brovey algorithm"))
@@ -311,13 +314,18 @@
(out, ms3, panmatch3, ms1, ms2, ms3),
overwrite=True)
- pb.wait()
- pg.wait()
- pr.wait()
+ pb.wait(), pg.wait(), pr.wait()
+ try:
+ pb.terminate(), pg.terminate(), pr.terminate()
+ except:
+ ""
# Cleanup
- grass.run_command('g.remove', flags='f', quiet=True, type='raster',
- name='%s,%s,%s' % (panmatch1, panmatch2, panmatch3))
+ try:
+ grass.run_command('g.remove', flags='f', quiet=True, type='raster',
+ name='%s,%s,%s' % (panmatch1, panmatch2, panmatch3))
+ except:
+ ""
def ihs(pan, ms1, ms2, ms3, out, pid, sproc):
grass.verbose(_("Using IHS<->RGB algorithm"))
@@ -347,8 +355,11 @@
blue="%s_blue" % out)
# Cleanup
- grass.run_command('g.remove', flags='f', quiet=True, type='raster',
- name=panmatch)
+ try:
+ grass.run_command('g.remove', flags='f', quiet=True, type='raster',
+ name=panmatch)
+ except:
+ ""
def pca(pan, ms1, ms2, ms3, out, pid, sproc):
@@ -477,17 +488,16 @@
b3mean),
overwrite=True)
- pb.wait()
- pg.wait()
- pr.wait()
+ pb.wait(), pg.wait(), pr.wait()
+ try:
+ pb.terminate(), pg.terminate(), pr.terminate()
+ except:
+ ""
# Cleanup
grass.run_command('g.remove', flags='f', quiet=True, type='raster',
name='%s,%s,%s' % (panmatch1, panmatch2, panmatch3))
- grass.run_command('g.remove', flags='f', quiet=True, type="raster",
- pattern='tmp%s*' % pid)
-
def matchhist(original, target, matched):
# pan/intensity histogram matching using numpy arrays
grass.message(_("Histogram matching..."))
More information about the grass-commit
mailing list