Skip to content

Commit 20e728f

Browse files
omit metadata when calling savefig to prevent spurious graph image diffs
1 parent 3c7b22d commit 20e728f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/geophires_docs/generate_fervo_project_red_2026_docs.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
_LONG_TERM_FORECAST_PLANT_LIFETIME_YEARS = 8
5151

5252
_GRAPH_DPI = 300
53+
_SAVEFIG_ARGS = {'dpi': _GRAPH_DPI, 'metadata': {'Date': None}}
5354

5455

5556
@dataclass
@@ -355,13 +356,13 @@ def _generate_production_temperature_comparison_graph(
355356
output_path_stem.parent.mkdir(parents=True, exist_ok=True)
356357

357358
ax.set_ylim(0.0, 200.0)
358-
fig.savefig(f'{output_path_stem}-1.png', dpi=_GRAPH_DPI, bbox_inches='tight')
359+
fig.savefig(f'{output_path_stem}-1.png', bbox_inches='tight', **_SAVEFIG_ARGS)
359360

360361
ax.set_ylim(
361362
175,
362363
185,
363364
)
364-
fig.savefig(f'{output_path_stem}-2.png', dpi=_GRAPH_DPI, bbox_inches='tight')
365+
fig.savefig(f'{output_path_stem}-2.png', bbox_inches='tight', **_SAVEFIG_ARGS)
365366

366367
plt.close(fig)
367368

@@ -435,7 +436,7 @@ def _generate_long_term_forecast_graph(
435436
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), ncol=1, frameon=False, fontsize=11)
436437

437438
output_path.parent.mkdir(parents=True, exist_ok=True)
438-
fig.savefig(output_path, dpi=_GRAPH_DPI, bbox_inches='tight')
439+
fig.savefig(output_path, bbox_inches='tight', **_SAVEFIG_ARGS)
439440
plt.close(fig)
440441

441442

@@ -658,8 +659,8 @@ def _savefig(version: int | str) -> None:
658659
sensitivity_graph_path.with_name(f'{sensitivity_graph_path.stem}-{version}').with_suffix(
659660
sensitivity_graph_path.suffix
660661
),
661-
dpi=_GRAPH_DPI,
662662
bbox_inches='tight',
663+
**_SAVEFIG_ARGS,
663664
)
664665

665666
ax.set_xlim(0.0, _LONG_TERM_FORECAST_PLANT_LIFETIME_YEARS)
@@ -719,7 +720,7 @@ def _savefig(version: int | str) -> None:
719720
ax_pwr.legend(handles=[baseline_patch, sensitivity_patch], loc='upper left', frameon=False)
720721

721722
power_graph_path.parent.mkdir(parents=True, exist_ok=True)
722-
fig_pwr.savefig(power_graph_path, dpi=_GRAPH_DPI, bbox_inches='tight')
723+
fig_pwr.savefig(power_graph_path, bbox_inches='tight', **_SAVEFIG_ARGS)
723724
plt.close(fig_pwr)
724725

725726
return df_power

0 commit comments

Comments
 (0)