|
4 | 4 | from typing import Any |
5 | 5 |
|
6 | 6 | import cv2 |
| 7 | +import matplotlib.patches as mpatches |
7 | 8 | import matplotlib.pyplot as plt |
8 | 9 | import numpy as np |
9 | 10 | import pandas as pd |
@@ -509,9 +510,9 @@ def _generate_fracture_sensitivity_graph( |
509 | 510 | show_excluded_measured_temperatures: bool = False, |
510 | 511 | calculate_stats: bool = True, |
511 | 512 | ) -> pd.DataFrame: |
512 | | - import matplotlib.patches as mpatches |
513 | | - |
514 | | - _log.info('Running 8-year fracture sensitivity analysis (including power generation)...') |
| 513 | + _log.info( |
| 514 | + f'Running {_LONG_TERM_FORECAST_PLANT_LIFETIME_YEARS}-year fracture sensitivity analysis (including power generation)...' |
| 515 | + ) |
515 | 516 |
|
516 | 517 | is_steady_state = _get_steady_state_mask(df_prod, steady_state_start_years) |
517 | 518 |
|
@@ -613,7 +614,7 @@ def _generate_fracture_sensitivity_graph( |
613 | 614 | final_temp_degc = float(geophires_y[-1]) if geophires_y else 0.0 |
614 | 615 | power_data.append( |
615 | 616 | { |
616 | | - 'Number of Fractures': frac_count, |
| 617 | + number_of_fractures_param_name: frac_count, |
617 | 618 | #'Average Net Electricity Production (MW)': avg_generation_v, |
618 | 619 | f'{avg_generation_param} ({avg_generation_u})': avg_generation_v, |
619 | 620 | f'Year {_LONG_TERM_FORECAST_PLANT_LIFETIME_YEARS} Flowing Temperature (°C)': final_temp_degc, |
@@ -672,16 +673,16 @@ def _savefig(version: int | str) -> None: |
672 | 673 | plt.close(fig) |
673 | 674 |
|
674 | 675 | df_power = pd.DataFrame(power_data) |
675 | | - df_power = df_power.sort_values('Number of Fractures').reset_index(drop=True) |
| 676 | + df_power = df_power.sort_values(number_of_fractures_param_name).reset_index(drop=True) |
676 | 677 | df_power.to_csv(power_csv_path, index=False) |
677 | 678 |
|
678 | 679 | fig_pwr, ax_pwr = plt.subplots(figsize=(8, 5)) |
679 | | - x_labels = [str(x) for x in df_power['Number of Fractures']] |
| 680 | + x_labels = [str(x) for x in df_power[number_of_fractures_param_name]] |
680 | 681 | y_values = df_power[f'{avg_generation_param} ({avg_generation_u})'] |
681 | 682 |
|
682 | 683 | bars = ax_pwr.bar(x_labels, y_values, color='#1f77b4', alpha=0.8, edgecolor='black') |
683 | 684 |
|
684 | | - baseline_idx = df_power.index[df_power['Number of Fractures'] == base_number_of_fractures].tolist()[0] |
| 685 | + baseline_idx = df_power.index[df_power[number_of_fractures_param_name] == base_number_of_fractures].tolist()[0] |
685 | 686 | bars[baseline_idx].set_color('green') |
686 | 687 | bars[baseline_idx].set_edgecolor('black') |
687 | 688 |
|
@@ -762,6 +763,7 @@ def _get_input_params_dict_with_nbsp() -> dict[str, Any]: |
762 | 763 | 'geophires_rmse_degc': f'{geophires_stats_alignment.rmse_degc:.2f}', |
763 | 764 | 'geophires_r2': f'{geophires_stats_alignment.r2:.4f}', |
764 | 765 | 'geophires_bias_degc': f'{geophires_stats_alignment.bias_degc:.2f}', |
| 766 | + 'long_term_forecast_years': _LONG_TERM_FORECAST_PLANT_LIFETIME_YEARS, |
765 | 767 | } |
766 | 768 |
|
767 | 769 | # Set up Jinja environment |
|
0 commit comments