Skip to content

Commit

Permalink
Merge pull request #309 from zmoon/logo-optional
Browse files Browse the repository at this point in the history
Add option to disable adding logo to plots
  • Loading branch information
zmoon authored Nov 14, 2024
2 parents d8cc60e + 8a55fc7 commit 3763816
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/appendix/yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ regarding the directory files are read from.
* **method:** The file format to read from. Options are 'netcdf' and 'pkl'.
* **filenames:** The filename(s) that should be read in. For method: 'netcdf' this must be set as a dict in the form filenames: {'group1':str or iterable of filename(s) in group1, group2: str or iterable of filename(s) in group2,...}. For method: 'pkl' this must be set as either a string with the filename or as an or iterable of filenames. Wildcards will be expanded to any matching files.

**add_logo:** This is an optional argument.
Set this to ``false`` to forgo adding the MELODIES MONET logo to the plots.

Models
------
All input for each instance of the model class. First level should be the model
Expand Down
7 changes: 7 additions & 0 deletions melodies_monet/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ def __init__(self):
self.obs_gridded_data = {}
self.obs_gridded_count = {}
self.obs_gridded_dataset = None
self.add_logo = True
"""bool, default=True : Add the MELODIES MONET logo to the plots."""

def __repr__(self):
return (
Expand Down Expand Up @@ -809,6 +811,8 @@ def read_control(self, control=None):
self.save = self.control_dict['analysis']['save']
if 'read' in self.control_dict['analysis'].keys():
self.read = self.control_dict['analysis']['read']
if 'add_logo' in self.control_dict['analysis'].keys():
self.add_logo = self.control_dict['analysis']['add_logo']

# set time_chunking_with_gridded_data option, regrid option, and target_grid
if 'time_chunking_with_gridded_data' in self.control_dict['analysis'].keys():
Expand Down Expand Up @@ -1498,6 +1502,9 @@ def plotting(self):
from .plots import aircraftplots as airplots
from .plots import ozone_sonder_plots as sonderplots

if not self.add_logo:
savefig.keywords.update(decorate=False)

# Disable figure count warning
initial_max_fig = plt.rcParams["figure.max_open_warning"]
plt.rcParams["figure.max_open_warning"] = 0
Expand Down
6 changes: 3 additions & 3 deletions melodies_monet/plots/satplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def make_spatial_overlay(df, vmodel, column_o=None, label_o=None, column_m=None,
cax.tick_params(labelsize=text_kwargs['fontsize']*0.8,length=10.0,width=2.0,grid_linewidth=2.0)

#plt.tight_layout(pad=0)
savefig(outname + '.png',loc=4, logo_height=100, decorate=True, bbox_inches='tight', dpi=150)
savefig(outname + '.png',loc=4, logo_height=100, bbox_inches='tight', dpi=150)
return ax

def calculate_boxplot(df, df_reg=None,column=None, label=None, plot_dict=None, comb_bx = None, label_bx = None):
Expand Down Expand Up @@ -671,7 +671,7 @@ def make_boxplot(comb_bx, label_bx, ylabel = None, vmin = None, vmax = None, out
ax.set_ylim(ymin = vmin, ymax = vmax)

plt.tight_layout()
savefig(outname + '.png',loc=4, logo_height=100, decorate=True, bbox_inches='tight', dpi=200)
savefig(outname + '.png',loc=4, logo_height=100, bbox_inches='tight', dpi=200)

def make_spatial_bias_gridded(df, column_o=None, label_o=None, column_m=None,
label_m=None, ylabel = None, vmin=None,
Expand Down Expand Up @@ -777,5 +777,5 @@ def make_spatial_bias_gridded(df, column_o=None, label_o=None, column_m=None,
cax.tick_params(labelsize=text_kwargs['fontsize']*0.8,length=10.0,width=2.0,grid_linewidth=2.0)

#plt.tight_layout(pad=0)
savefig(outname + '.png',loc=4, logo_height=100, decorate=True, bbox_inches='tight', dpi=150)
savefig(outname + '.png',loc=4, logo_height=100, bbox_inches='tight', dpi=150)
return ax

0 comments on commit 3763816

Please sign in to comment.