From 29a21550e9cdaeb371190b5684dc6c2201b1a905 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 30 Jan 2024 01:08:59 +0100 Subject: minor RAM optimisation --- plotter/vertical_from_grib.py | 4 ++++ run.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/plotter/vertical_from_grib.py b/plotter/vertical_from_grib.py index 79c367f..ff454b3 100755 --- a/plotter/vertical_from_grib.py +++ b/plotter/vertical_from_grib.py @@ -4,6 +4,8 @@ import os import datetime import json +import matplotlib.pyplot as plt + import xarray as xr from metpy.units import units import metpy.calc as mpcalc @@ -77,6 +79,8 @@ def _plot(data, output, name, lat=None, lon=None, analysis=None): outname = f'skewt_{name}_{init_for_filename}+{hours_since_init_str}.png' skt.plot(filename=os.path.join(output, outname)) + plt.close('all') + index.append( { 'file': outname, diff --git a/run.py b/run.py index 244da10..f239f45 100755 --- a/run.py +++ b/run.py @@ -22,6 +22,8 @@ def create_aggregators(cfg): return ret +mpl.use('agg') + # Define custom gpm and gpdm units. The default gpm in metpy is aliased to meter. # We need the correct definition units.define('_gpm = 9.80665 * J/kg') -- cgit v1.2.3