Skip to content

Commit

Permalink
seperate save_netcdf from plot()
Browse files Browse the repository at this point in the history
  • Loading branch information
lukruh committed Nov 21, 2024
1 parent 22e1c5d commit 5df02db
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions esmvaltool/diag_scripts/portrait_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,9 @@ def plot_overlays(cfg, grid, data):
def plot(cfg, data):
"""Create figure with subplots for each group and save to NetCDF.
sets same color range and overlays additional references based on
Sets same color range and overlays additional references based on
the content of data (xr.DataArray).
"""
save_to_netcdf(cfg, data)

fig = plt.figure(1, cfg.get("figsize", (5.5, 3.5)))
group_count = len(data.coords[cfg["group_by"]])
grid = ImageGrid(
Expand Down Expand Up @@ -510,8 +508,6 @@ def main(cfg):
dataset["var"] = normalize(dataset["var"], cfg["normalize"],
[cfg["x_by"], cfg["group_by"]])
plot(cfg, dataset["var"])


if __name__ == "__main__":
save_to_netcdf(cfg, dataset["var"])
with run_diagnostic() as config:
main(config)

0 comments on commit 5df02db

Please sign in to comment.