Skip to content

Commit

Permalink
Correctly handle ~ when reading plot_folder option of monitoring …
Browse files Browse the repository at this point in the history
…diagnostic (#3449)
  • Loading branch information
schlunma authored Nov 30, 2023
1 parent a648820 commit d8b9d24
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions esmvaltool/diag_scripts/monitor/monitor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def __init__(self, config):
)
plot_folder = plot_folder.replace('{plot_dir}',
self.cfg[names.PLOT_DIR])
self.plot_folder = os.path.abspath(plot_folder)
self.plot_folder = os.path.abspath(
os.path.expandvars(os.path.expanduser(plot_folder))
)
self.plot_filename = config.get(
'plot_filename',
'{plot_type}_{real_name}_{dataset}_{mip}_{exp}_{ensemble}')
Expand Down Expand Up @@ -293,11 +295,7 @@ def get_plot_folder(self, var_info):
'real_name': self._real_name(var_info['variable_group']),
**var_info
}
folder = os.path.expandvars(
os.path.expanduser(
list(_replace_tags(self.plot_folder, info))[0]
)
)
folder = list(_replace_tags(self.plot_folder, info))[0]
if self.plot_folder.startswith('/'):
folder = '/' + folder
if not os.path.isdir(folder):
Expand Down

0 comments on commit d8b9d24

Please sign in to comment.