diff --git a/zppy_interfaces/global_time_series/coupled_global.py b/zppy_interfaces/global_time_series/coupled_global.py index 01362ff..afd7d90 100644 --- a/zppy_interfaces/global_time_series/coupled_global.py +++ b/zppy_interfaces/global_time_series/coupled_global.py @@ -332,11 +332,17 @@ def coupled_global(parameters: Parameters) -> None: # In this case, we don't want the summary PDF. # Rather, we want to construct a viewer similar to E3SM Diags. title_and_url_list: List[Tuple[str, str]] = [] - for component in ["original", "atm", "ice", "lnd", "ocn"]: + for component in ["atm", "ice", "lnd", "ocn"]: # Don't create viewer for original component vars = get_vars(requested_variables, component) if vars: url = create_viewer(parameters, vars, component) logger.info(f"Viewer URL for {component}: {url}") title_and_url_list.append((component, url)) + # Special case for original - these are always multi-plot PDFs + vars = get_vars(requested_variables, "original") + if vars: + logger.info("Original plots will be in multi-plot PDF format") + title_and_url_list.append(("original", f"{parameters.results_dir}/{parameters.figstr}_glb_original.pdf")) + index_url: str = create_viewer_index(parameters.results_dir, title_and_url_list) logger.info(f"Viewer index URL: {index_url}") diff --git a/zppy_interfaces/global_time_series/coupled_global_plotting.py b/zppy_interfaces/global_time_series/coupled_global_plotting.py index 3973a77..579b3a2 100644 --- a/zppy_interfaces/global_time_series/coupled_global_plotting.py +++ b/zppy_interfaces/global_time_series/coupled_global_plotting.py @@ -554,7 +554,16 @@ def make_plot_pdfs( # noqa: C901 num_plots = len(plot_list) if num_plots == 0: return - plots_per_page = parameters.nrows * parameters.ncols + + # For original plots, always use multiple plots per page regardless of make_viewer setting + use_multi_plot = not parameters.make_viewer or component == "original" + + # Determine layout based on whether we're using multi-plot or single-plot mode + if use_multi_plot: + plots_per_page = parameters.nrows * parameters.ncols + else: + plots_per_page = 1 # For viewer mode, one plot per page + num_pages = math.ceil(num_plots / plots_per_page) counter = 0 @@ -573,7 +582,9 @@ def make_plot_pdfs( # noqa: C901 # The final page doesn't need to be filled out with plots. if counter >= num_plots: break - ax = plt.subplot(parameters.nrows, parameters.ncols, j + 1) + ax = plt.subplot(parameters.nrows if use_multi_plot else 1, + parameters.ncols if use_multi_plot else 1, + j + 1) if component == "original": try: plot_function = PLOT_DICT[plot_list[counter]] @@ -616,6 +627,7 @@ def make_plot_pdfs( # noqa: C901 fig.tight_layout() pdf.savefig(1) + # Always save individual PNGs for viewer mode if plots_per_page == 1: fig.savefig( f"{parameters.results_dir}/{parameters.figstr}_{rgn}_{component}_{plot_name}.png", diff --git a/zppy_interfaces/global_time_series/utils.py b/zppy_interfaces/global_time_series/utils.py index 84fb649..b494da4 100644 --- a/zppy_interfaces/global_time_series/utils.py +++ b/zppy_interfaces/global_time_series/utils.py @@ -39,6 +39,8 @@ def __init__(self, args: Dict[str, str]): raise RuntimeError( f"make_viewer requires 1x1 plots, but nrows={self.nrows} and ncols={self.ncols}" ) + # For "original" plots, always use multiple plots per page regardless of make_viewer setting + self.original_plots_multi: bool = True # For both self.year1: int = int(args["start_yr"])