revert(plotting): 恢复原始 plotting.py 并添加适配层
1. 从初始提交 (f085d7c) 恢复完整的原始 plotting.py
- 原始配色: geyser 色阶, simple_white 模板
- 风玫瑰: Beaufort 12级分桶 + turquoise 扇形
- 时序图: 散点 + 滚动均线 + 多Y轴
- 背景校正: 双Y轴 + timestamp + 虚线基线
- 3D散点: px.scatter_3d + 自定义 hover
- 克里金: 散点叠加等高线 + 地面线
2. 新增适配包装函数(原始签名与当前调用方式不兼容):
- _scatter_3d_wrapper(df,gas) → scatter_3d(df,color=...)
- _windrose_wrapper(df) → windrose(df)
- _time_series_wrapper(df) → time_series(df,ys=['windspeed'])
- _contour_krig_wrapper(krig_vars) → contour_krig(df,gas,xx,yy,field)
- _heatmap_krig_wrapper(krig_vars) → heatmap_krig(xx,yy,field)
- _semivariogram_plot(variogram,gas) → 保留 Plotly 实现
- _outliers_wrapper(df,col,name) → outliers(series,high,low)
3. 更新调用方使用包装函数:
- processing_pipelines.py: _scatter_3d_wrapper/_windrose_wrapper/_time_series_wrapper
- interpolation.py: _contour_krig_wrapper/_heatmap_krig_wrapper/_semivariogram_plot
- pre_processing.py: _outliers_wrapper
This commit is contained in:
@ -120,15 +120,15 @@ def ordinary_kriging(
|
||||
|
||||
# Generate plots (must be after krig_variables is defined)
|
||||
try:
|
||||
contour_plot = plotting.contour_krig(krig_variables)
|
||||
contour_plot = plotting._contour_krig_wrapper(krig_variables)
|
||||
except Exception:
|
||||
contour_plot = None
|
||||
try:
|
||||
grid_plot = plotting.heatmap_krig(krig_variables)
|
||||
grid_plot = plotting._heatmap_krig_wrapper(krig_variables)
|
||||
except Exception:
|
||||
grid_plot = None
|
||||
try:
|
||||
semivariogram_plot = plotting.semivariogram_plot(semivariogram, gas)
|
||||
semivariogram_plot = plotting._semivariogram_plot(semivariogram, gas)
|
||||
except Exception:
|
||||
semivariogram_plot = None
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -131,7 +131,7 @@ def remove_outliers(df: pd.DataFrame, column: str, name: str):
|
||||
|
||||
try:
|
||||
from . import plotting
|
||||
fig = plotting.outliers(df, column, name)
|
||||
fig = plotting._outliers_wrapper(df, column, name)
|
||||
except Exception:
|
||||
fig = None
|
||||
|
||||
|
||||
@ -126,18 +126,18 @@ class InSituSensorStrategy(SensorStrategy):
|
||||
for gas in self.data_processor.gases:
|
||||
# Create 3D scatter plot of flight path with gas concentration
|
||||
try:
|
||||
self.data_processor.figs["scatter_3d"][gas] = plotting.scatter_3d(
|
||||
self.data_processor.figs["scatter_3d"][gas] = plotting._scatter_3d_wrapper(
|
||||
self.data_processor.df, gas
|
||||
)
|
||||
except Exception:
|
||||
self.data_processor.figs["scatter_3d"][gas] = plotting.blank_figure()
|
||||
# Create wind rose and time series plots
|
||||
try:
|
||||
self.data_processor.figs["windrose"] = plotting.windrose(self.data_processor.df)
|
||||
self.data_processor.figs["windrose"] = plotting._windrose_wrapper(self.data_processor.df)
|
||||
except Exception:
|
||||
self.data_processor.figs["windrose"] = plotting.blank_figure()
|
||||
try:
|
||||
self.data_processor.figs["wind_timeseries"] = plotting.time_series(self.data_processor.df)
|
||||
self.data_processor.figs["wind_timeseries"] = plotting._time_series_wrapper(self.data_processor.df)
|
||||
except Exception:
|
||||
self.data_processor.figs["wind_timeseries"] = plotting.blank_figure()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user