Skip to content

Commit 3e9af76

Browse files
exclude thermal conditioning
1 parent 08cb6b6 commit 3e9af76

1 file changed

Lines changed: 35 additions & 25 deletions

File tree

src/geophires_docs/generate_fervo_project_red_2026_docs.py

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
_STEADY_STATE_CSV_FILENAME = 'project_red_2026_variance_analysis.csv'
2525
_REGENERATED_GRAPH_FILENAME = 'project_red_2026_figure-5_regenerated.png'
2626

27-
_STEADY_STATE_START_YEARS = 0.125
27+
_STEADY_STATE_START_YEARS = 0.041625
2828

2929
_HOUGH_MIN_DIST_PX = 4
3030

@@ -231,7 +231,7 @@ def _get_steady_state_mask(df_prod: pd.DataFrame, steady_state_start_years: floa
231231
return is_steady
232232

233233

234-
def _regenerate_graph_from_csv(
234+
def _generate_production_temperature_comparison_graph(
235235
production_csv_path: Path,
236236
model_csv_path: Path,
237237
steady_state_csv_path: Path,
@@ -242,11 +242,19 @@ def _regenerate_graph_from_csv(
242242
df_prod = pd.read_csv(production_csv_path)
243243
df_model = pd.read_csv(model_csv_path)
244244

245-
is_ramp_up = df_prod['Time_Years'] <= steady_state_start_years
246-
is_steady = _get_steady_state_mask(df_prod, steady_state_start_years)
245+
is_thermal_conditioning = df_prod['Time_Years'] <= steady_state_start_years # noqa: F841
246+
is_steady_state = _get_steady_state_mask(df_prod, steady_state_start_years)
247247

248-
df_included = df_prod[is_ramp_up | is_steady]
249-
df_excluded = df_prod[~(is_ramp_up | is_steady)]
248+
df_included = df_prod[
249+
# is_thermal_conditioning |
250+
is_steady_state
251+
]
252+
df_excluded = df_prod[
253+
~(
254+
# is_thermal_conditioning |
255+
is_steady_state
256+
)
257+
]
250258

251259
fig, ax = plt.subplots(figsize=(10, 6))
252260

@@ -260,7 +268,7 @@ def _regenerate_graph_from_csv(
260268
alpha=0.85,
261269
label='Measured '
262270
# f'Flowing '
263-
'Temperature (Thermal Conditioning and Steady State)', # TODO exclude Thermal Conditioning
271+
'Temperature (Steady State)',
264272
# f', n={len(df_included)}',
265273
)
266274

@@ -275,7 +283,9 @@ def _regenerate_graph_from_csv(
275283
alpha=0.5,
276284
label='Measured '
277285
# f'Flowing '
278-
'Temperature (Excluded Operational Periods)', # TODO better wording/phrasing
286+
'Temperature (Thermal Conditioning '
287+
'& Excluded Operational Periods' # TODO better wording/phrasing
288+
')',
279289
# f', n={len(df_excluded)}',
280290
)
281291

@@ -321,7 +331,7 @@ def _get_file_path(file_name: str) -> Path:
321331
return Path(__file__).parent / file_name
322332

323333

324-
def get_project_red_production_temperature_profile_series() -> pd.Series:
334+
def get_project_red_production_temperature_profile_series(fervo_graph_df_model: pd.Series) -> pd.Series:
325335
input_params: GeophiresInputParameters = ImmutableGeophiresInputParameters(
326336
from_file_path=_get_file_path('../../tests/examples/Fervo_Project_Red-2026.txt')
327337
)
@@ -343,9 +353,9 @@ def get_project_red_production_temperature_profile_series() -> pd.Series:
343353

344354
# Interpolate the GEOPHIRES curve along the exact timestamps established by the model dashed line extraction
345355
geophires_interpolator = interp1d(geophires_x, geophires_y, kind='linear', fill_value='extrapolate')
346-
geophires_interpolated_y = geophires_interpolator(df_model['Time_Years'])
356+
geophires_interpolated_y = geophires_interpolator(fervo_graph_df_model['Time_Years'])
347357

348-
geophires_series = pd.Series(data=geophires_interpolated_y, index=df_model['Time_Years'])
358+
geophires_series = pd.Series(data=geophires_interpolated_y, index=fervo_graph_df_model['Time_Years'])
349359

350360
return geophires_series
351361

@@ -355,24 +365,24 @@ def get_project_red_production_temperature_profile_series() -> pd.Series:
355365
PRODUCTION_IMAGE_PATH = _get_file_path('fervo_project_red-2026_graph-data-extraction_production-series-edited.png')
356366

357367
_BUILD_DIR.mkdir(parents=True, exist_ok=True)
358-
production_csv_path = _BUILD_DIR / _PRODUCTION_CSV_FILENAME
359-
model_csv_path = _BUILD_DIR / _MODEL_CSV_FILENAME
368+
production_csv_path_ = _BUILD_DIR / _PRODUCTION_CSV_FILENAME
369+
model_csv_path_ = _BUILD_DIR / _MODEL_CSV_FILENAME
360370
steady_state_csv_path = _BUILD_DIR / _STEADY_STATE_CSV_FILENAME
361371
regenerated_graph_path = _BUILD_DIR / _REGENERATED_GRAPH_FILENAME
362372

363373
_log.info('Extracting data from image...')
364-
df_actual, df_model = extract_plot_data(IMAGE_PATH, PRODUCTION_IMAGE_PATH)
374+
df_actual, df_model_ = extract_plot_data(IMAGE_PATH, PRODUCTION_IMAGE_PATH)
365375

366376
_log.info(f'Extracted {len(df_actual)} production data points.')
367-
_log.info(f'Extracted {len(df_model)} model line data points.')
377+
_log.info(f'Extracted {len(df_model_)} model line data points.')
368378

369-
df_actual.to_csv(production_csv_path, index=False)
370-
df_model.to_csv(model_csv_path, index=False)
371-
_log.info(f'Wrote production data CSV: {production_csv_path}')
372-
_log.info(f'Wrote model data CSV: {model_csv_path}')
379+
df_actual.to_csv(production_csv_path_, index=False)
380+
df_model_.to_csv(model_csv_path_, index=False)
381+
_log.info(f'Wrote production data CSV: {production_csv_path_}')
382+
_log.info(f'Wrote model data CSV: {model_csv_path_}')
373383

374-
if not df_actual.empty and not df_model.empty:
375-
df_steady_state = _calculate_variance_analysis(df_actual, df_model)
384+
if not df_actual.empty and not df_model_.empty:
385+
df_steady_state = _calculate_variance_analysis(df_actual, df_model_)
376386

377387
rmse = float(np.sqrt((df_steady_state['Error_C'] ** 2).mean()))
378388
mae = float(df_steady_state['Error_C'].abs().mean())
@@ -386,11 +396,11 @@ def get_project_red_production_temperature_profile_series() -> pd.Series:
386396
df_steady_state.to_csv(steady_state_csv_path, index=False)
387397
_log.info(f'Wrote variance analysis CSV: {steady_state_csv_path}')
388398

389-
_regenerate_graph_from_csv(
390-
production_csv_path,
391-
model_csv_path,
399+
_generate_production_temperature_comparison_graph(
400+
production_csv_path_,
401+
model_csv_path_,
392402
steady_state_csv_path,
393403
regenerated_graph_path,
394-
geophires_data=get_project_red_production_temperature_profile_series(),
404+
geophires_data=get_project_red_production_temperature_profile_series(df_model_),
395405
)
396406
_log.info(f'Wrote regenerated graph: {regenerated_graph_path}')

0 commit comments

Comments
 (0)