Skip to content

Commit

Permalink
Added matplotlib close methods after each image is generated so that …
Browse files Browse the repository at this point in the history
…they don't stay open and use up a bunch of memory
  • Loading branch information
daminton committed Oct 21, 2022
1 parent 43c1899 commit 300550f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/ctem/ctem/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 300550f

Please sign in to comment.