fix: heatmap_path 提前声明避免水色指数模式下 UnboundLocalError
This commit is contained in:
@ -1784,10 +1784,10 @@ class WaterQualityReportGenerator:
|
||||
doc.add_paragraph() # 表格和热力图之间的空行
|
||||
|
||||
# 2. 添加相关性热力图(放在表格下方)—— 仅 ML 模式
|
||||
heatmap_path = vis_dir / "correlation_heatmap.png"
|
||||
if getattr(self, '_pipeline_mode', 'ml') == 'ml':
|
||||
h3 = doc.add_heading("4.2 水质参数相关性分析", level=2)
|
||||
self._style_heading(h3, level=2)
|
||||
heatmap_path = vis_dir / "correlation_heatmap.png"
|
||||
figure_num = start_figure_num
|
||||
if heatmap_path.exists():
|
||||
try:
|
||||
@ -1827,7 +1827,9 @@ class WaterQualityReportGenerator:
|
||||
pass
|
||||
|
||||
doc.add_page_break()
|
||||
return start_figure_num + (1 if heatmap_path.exists() else 0)
|
||||
heatmap_added = 1 if (getattr(self, '_pipeline_mode', 'ml') == 'ml'
|
||||
and heatmap_path.exists()) else 0
|
||||
return start_figure_num + heatmap_added
|
||||
|
||||
def _add_physical_inversion_section(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user