From 300550f63826fd5eccd6ce94579ea387a733cc5f Mon Sep 17 00:00:00 2001 From: David A Minton Date: Fri, 21 Oct 2022 14:07:49 -0400 Subject: [PATCH] Added matplotlib close methods after each image is generated so that they don't stay open and use up a bunch of memory --- python/ctem/ctem/io.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/ctem/ctem/io.py b/python/ctem/ctem/io.py index d0d383e5..144b419d 100644 --- a/python/ctem/ctem/io.py +++ b/python/ctem/ctem/io.py @@ -105,6 +105,7 @@ def create_rplot(user, odist, pdist, tdist, ph1): plt.tick_params(axis='both', which='minor', labelsize=12) plt.savefig(filename) + plt.close() return @@ -129,6 +130,7 @@ def image_dem(user, DEM): # Save image to file filename = os.path.join(user['workingdir'],'surf',"surf%06d.png" % user['ncount']) plt.savefig(filename, dpi=dpi, bbox_inches=0) + plt.close() return @@ -201,6 +203,8 @@ def image_shaded_relief(user, DEM): # Save image to file filename = os.path.join(user['workingdir'],'shaded',"shaded%06d.png" % user['ncount']) plt.savefig(filename, dpi=dpi, bbox_inches=0) + plt.close() + return user