Skip to content

Commit 6120f89

Browse files
Regenerate example1_addons.csv when "regenerate-example.result.sh example1_addons" is run
1 parent c9125b5 commit 6120f89

File tree

6 files changed

+32
-10
lines changed

6 files changed

+32
-10
lines changed

tests/example1_addons.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ SURFACE EQUIPMENT SIMULATION RESULTS,Average Annual Net Electricity Generation,,
9999
SURFACE EQUIPMENT SIMULATION RESULTS,Average Pumping Power,,0.2,MW
100100
SURFACE EQUIPMENT SIMULATION RESULTS,Initial pumping power/net installed power,,3.82,%
101101
SURFACE EQUIPMENT SIMULATION RESULTS,First Law Efficiency,,10.07,%
102-
Simulation Metadata,GEOPHIRES Version,,3.7.0,
102+
Simulation Metadata,GEOPHIRES Version,,3.7.1,
103103
POWER GENERATION PROFILE,THERMAL DRAWDOWN,1,1.0,
104104
POWER GENERATION PROFILE,THERMAL DRAWDOWN,2,1.0056,
105105
POWER GENERATION PROFILE,THERMAL DRAWDOWN,3,1.0073,

tests/examples/example1_addons.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Simulation Metadata
66
----------------------
7-
GEOPHIRES Version: 3.7.0
8-
Simulation Date: 2025-01-20
9-
Simulation Time: 11:30
10-
Calculation Time: 0.821 sec
7+
GEOPHIRES Version: 3.7.1
8+
Simulation Date: 2025-01-21
9+
Simulation Time: 08:07
10+
Calculation Time: 0.814 sec
1111

1212
***SUMMARY OF RESULTS***
1313

tests/regenerate-example-result.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ cd ..
3131
#./tests/regenerate-example-result.ps1 example_SHR-2
3232
#./tests/regenerate-example-result.ps1 Fervo_Norbeck_Latimer_2024
3333
#./tests/regenerate-example-result.ps1 Wanju_Yuan_Closed-Loop_Geothermal_Energy_Recovery
34+
35+
# TODO regenerate CSV for example1_addons as in regenerate-example-result.sh

tests/regenerate-example-result.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@
1212
cd "$(dirname "$0")"
1313
python -mgeophires_x examples/$1.txt examples/$1.out
1414
rm examples/$1.json
15+
16+
if [[ $1 == "example1_addons" ]]
17+
then
18+
echo "Updating CSV..."
19+
python regenerate_example_result_csv.py
20+
fi
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import os
2+
from pathlib import Path
3+
4+
from geophires_x_client import GeophiresXResult
5+
6+
7+
def _get_file_path(file_name: str | Path) -> str:
8+
return os.path.join(os.path.abspath(os.path.dirname(__file__)), str(file_name))
9+
10+
11+
if __name__ == '__main__':
12+
with open(_get_file_path('example1_addons.csv'), 'w', encoding='utf-8') as csvfile:
13+
csvfile.write(GeophiresXResult(_get_file_path('examples/example1_addons.out')).as_csv())

tests/test_geophires_x_client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,13 @@ def test_input_with_non_default_units(self):
456456

457457
def test_csv(self):
458458
"""
459-
TODO make this less tedious to update when expected result values change
459+
Note: example1_addons.csv will be updated automatically when `regenerate-example-result.sh example1_addons` is
460+
run.
460461
461-
Current easiest method to update:
462-
1. set breakpoint on line after `as_csv = result.as_csv()`
463-
2. debug test, hit break point
464-
3. copy-paste value of `as_csv` to example1_addons.csv
462+
If needed, example1_addons.csv can also be updated manually with the following steps:
463+
1. In your IDE, set a breakpoint on the line after `as_csv = result.as_csv()`
464+
2. Debug this test and hit the break point
465+
3. Copy-paste the value of `as_csv` (in Threads & Variables tab in PyCharm) to example1_addons.csv
465466
"""
466467

467468
def assertFileContentsEqual(expected_file_path, actual_file_path, tol=0.01):

0 commit comments

Comments
 (0)