diff --git a/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-1.png b/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-1.png index 3d1bb881..2877efee 100644 Binary files a/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-1.png and b/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-1.png differ diff --git a/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-2.png b/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-2.png index 344e73f5..af7999ba 100644 Binary files a/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-2.png and b/docs/_images/fervo_project_red-2026_production-temperature-data-vs-modeling-fracture-sensitivity-2.png differ diff --git a/src/geophires_docs/generate_fervo_project_red_2026_docs.py b/src/geophires_docs/generate_fervo_project_red_2026_docs.py index 2b81ab4a..b82f9dcc 100644 --- a/src/geophires_docs/generate_fervo_project_red_2026_docs.py +++ b/src/geophires_docs/generate_fervo_project_red_2026_docs.py @@ -31,7 +31,7 @@ _PRODUCTION_CSV_FILENAME = 'project_red_2026_production_data.csv' _MODEL_CSV_FILENAME = 'project_red_2026_model_data.csv' -_STEADY_STATE_CSV_FILENAME = 'project_red_2026_variance_analysis.csv' +_VARIANCE_ANALYSIS_CSV_FILENAME = 'project_red_2026_variance_analysis.csv' _GENERATED_GRAPH_FILENAME_STEM = 'fervo_project_red-2026_production-temperature-data-vs-modeling' _STEADY_STATE_START_YEARS = 0.041625 @@ -268,7 +268,6 @@ def _get_steady_state_mask(df_prod: pd.DataFrame, steady_state_start_years: floa def _generate_production_temperature_comparison_graph( production_csv_path: Path, model_csv_path: Path, - steady_state_csv_path: Path, output_path_stem: Path, steady_state_start_years: float = _STEADY_STATE_START_YEARS, geophires_data: pd.Series | None = None, @@ -471,7 +470,6 @@ def get_project_red_production_temperature_profile_series( pd.Series, Any, # interpolator ]: - input_and_result = get_project_red_input_params_and_result() input_params: GeophiresInputParameters = input_and_result[0] @@ -528,6 +526,7 @@ def _generate_fracture_sensitivity_graph( sensitivity_graph_path: Path, power_graph_path: Path, power_csv_path: Path, + df_variance: pd.DataFrame | None = None, show_excluded_measured_temperatures: bool = False, calculate_stats: bool = True, ) -> pd.DataFrame: @@ -631,11 +630,19 @@ def _generate_fracture_sensitivity_graph( geo_interp = interp1d(geophires_x, geophires_y, kind='linear', fill_value='extrapolate') y_geo = geo_interp(df_included['Time_Years']) + if df_variance is not None: + df_variance[f'GEOPHIRES_Modeled_Temperature_C_{frac_count}_Fractures'] = geo_interp( + df_variance['Time_Years'] + ) + rmse_g = float(np.sqrt(((y_true - y_geo) ** 2).mean())) bias_g = float((y_geo - y_true).mean()) ss_res_g = float(np.sum((y_true - y_geo) ** 2)) r2_g = 1.0 - (ss_res_g / ss_tot) if ss_tot != 0.0 else 0.0 + if df_variance is not None: + df_variance.loc[0, f'GEOPHIRES_R2_{frac_count}_Fractures'] = r2_g + _log.info(f'{frac_count} Fractures: RMSE={rmse_g:.2f}°C, R²={r2_g:.4f}, Bias={bias_g:.2f}°C') label_prefix = 'GEOPHIRES: ' if frac_count == base_number_of_fractures else '' @@ -738,7 +745,6 @@ def generate_fervo_project_red_2026_md( geophires_stats_alignment: _StatsAlignmentResult, project_root: Path = _PROJECT_ROOT, ) -> None: - result_values: dict[str, Any] = {} # get_result_values(result) def _get_input_params_dict_with_nbsp() -> dict[str, Any]: @@ -798,7 +804,7 @@ def generate_fervo_project_red_2026_docs(): _BUILD_DIR.mkdir(parents=True, exist_ok=True) production_csv_path_ = _BUILD_DIR / _PRODUCTION_CSV_FILENAME model_csv_path_ = _BUILD_DIR / _MODEL_CSV_FILENAME - steady_state_csv_path = _BUILD_DIR / _STEADY_STATE_CSV_FILENAME + variance_analysis_csv_path = _BUILD_DIR / _VARIANCE_ANALYSIS_CSV_FILENAME generated_graph_path_stem = _get_file_path(f'../../docs/_images/{_GENERATED_GRAPH_FILENAME_STEM}') _log.info('Extracting data from image...') @@ -860,16 +866,16 @@ def generate_fervo_project_red_2026_docs(): df_model_['Time_Years'], df_model_['Temperature_C'], kind='linear', fill_value='extrapolate' ) df_variance['Fervo_Modeled_Temperature_C'] = model_interpolator(df_variance['Time_Years']) - df_variance['GEOPHIRES_Modeled_Temperature_C'] = geo_interp(df_variance['Time_Years']) + df_variance.loc[0, 'Fervo_R2'] = fervo_stat_result.r2 - df_variance.to_csv(steady_state_csv_path, index=False) + df_variance['GEOPHIRES_Modeled_Temperature_C'] = geo_interp(df_variance['Time_Years']) + df_variance.loc[0, 'GEOPHIRES_R2'] = geophires_stat_result.r2 _tab = ' ' _generate_production_temperature_comparison_graph( production_csv_path_, model_csv_path_, - steady_state_csv_path, generated_graph_path_stem, geophires_data=geophires_series, fervo_modeled_stats_caption=f'\n{_tab}{fervo_modeled_stats_caption}\n', @@ -896,9 +902,13 @@ def generate_fervo_project_red_2026_docs(): _get_file_path(f'../../docs/_images/{_GENERATED_GRAPH_FILENAME_STEM}-fracture-sensitivity.png'), _get_file_path(f'../../docs/_images/{_GENERATED_GRAPH_FILENAME_STEM}-power-sensitivity.png'), _BUILD_DIR / 'project_red_2026_power_sensitivity.csv', + df_variance=df_variance, ) _log.info('Wrote sensitivity graphs and power data') + df_variance.to_csv(variance_analysis_csv_path, index=False) + _log.info(f'Wrote variance analysis CSV: {variance_analysis_csv_path}') + generate_fervo_project_red_2026_md( *get_project_red_input_params_and_result(), fervo_stat_result, geophires_stat_result )