You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.. (Eventually package will be published to PyPi, enabling ``pip install geophires-x``)
23
+
24
+
25
+
Editable Installation (Recommended)
26
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
+
28
+
An editable installation is recommended for most users. It will allow you to run GEOPHIRES-X locally,
29
+
view its Python files in an IDE or text editor,
30
+
and create your own extensions as described in `How to extend GEOPHIRES-X <docs/How-to-extend-GEOPHIRES-X.md#how-to-extend-geophires-x>`__.
31
+
32
+
Prerequisites:
33
+
34
+
1. Python 3.8+: You must have Python 3.8 or later installed on your machine. Python can be downloaded at `python.org/downloads <https://www.python.org/downloads/>`__. (On Ubuntu: ``alias python=python3`` if not aliased already.)
3. Virtual environment (aka ``virtualenv``): `Install virtual environment on your machine <https://virtualenv.pypa.io/en/latest/installation.html#via-pip>`__ if you don't have it already
37
+
4. On Windows, you will need Admin privileges (required to successfully activate the virtual environment)
38
+
39
+
Steps:
40
+
41
+
1. Open a command line (i.e. Terminal on Mac, PowerShell on Windows)
7. View and edit source code by opening the ``my-geophires-project/`` directory in an IDE or editor such as `PyCharm <https://www.jetbrains.com/pycharm/>`__, `Spyder <https://www.spyder-ide.org/>`__, or `Visual Studio Code <https://code.visualstudio.com/>`__. The GEOPHIRES-X source code will be located in the ``my-geophires-project/geophires-x`` directory. You can add your own python files in ``my-geophires-x/`` that use the source as a module as shown below.
73
+
74
+
To update the editable installation with the latest GEOPHIRES version::
75
+
76
+
cd geophires-x
77
+
git pull
78
+
# resolve merge conflicts, if any
79
+
pip install -e .
80
+
81
+
82
+
83
+
Usage
84
+
-----
85
+
86
+
Python
87
+
^^^^^^
88
+
89
+
Example usage in Python:
90
+
91
+
.. code:: python
92
+
93
+
from geophires_x_client import GeophiresXClient
94
+
from geophires_x_client.geophires_input_parameters import GeophiresInputParameters
95
+
96
+
client = GeophiresXClient()
97
+
result = client.get_geophires_result(
98
+
GeophiresInputParameters({
99
+
"Gradient 1": "69",
100
+
"Reservoir Depth": "5",
101
+
"End-Use Option": "1",
102
+
"Power Plant Type": "4"
103
+
})
104
+
)
105
+
106
+
withopen(result.output_file_path, 'r') as f:
107
+
print(f.read())
108
+
109
+
If you followed the editable installation example above, put this code in ``my-geophires-project/main.py``, then run::
110
+
111
+
python main.py
112
+
113
+
You will then see output including a case report::
114
+
115
+
(venv) ➜ my-geophires-project python main.py
116
+
No valid plant outlet pressure provided. GEOPHIRES will assume default plant outlet pressure (100 kPa)
117
+
No valid plant outlet pressure provided. GEOPHIRES will assume default plant outlet pressure (100 kPa)
118
+
119
+
*****************
120
+
***CASE REPORT***
121
+
*****************
122
+
123
+
Simulation Metadata
124
+
----------------------
125
+
GEOPHIRES Version: 3.4.42
126
+
Simulation Date: 2024-07-08
127
+
Simulation Time: 10:07
128
+
Calculation Time: 0.047 sec
129
+
130
+
***SUMMARY OF RESULTS***
131
+
132
+
End-Use Option: Electricity
133
+
Average Net Electricity Production: 23.94 MW
134
+
Electricity breakeven price: 5.04 cents/kWh
135
+
136
+
[...]
137
+
138
+
139
+
You may also pass parameters as a text file:
140
+
141
+
.. code:: python
142
+
143
+
from pathlib import Path
144
+
from geophires_x_client import GeophiresXClient
145
+
from geophires_x_client.geophires_input_parameters import GeophiresInputParameters
`test_geophires_x.py <tests/test_geophires_x.py>`__ has additional examples of how to consume and call `GeophiresXClient <src/geophires_x_client/__init__.py#L14>`__.
160
+
161
+
162
+
Command Line
163
+
^^^^^^^^^^^^
164
+
165
+
If you installed with pip (editable or non-), you may run GEOPHIRES from the command line, passing your input file as an argument::
166
+
167
+
python -mgeophires_x my_geophires_input.txt
168
+
169
+
You may also optionally pass the output file as well::
.. (Eventually package will be published to PyPi, enabling ``pip install geophires-x``)
103
-
104
-
105
-
Editable Installation (Recommended)
106
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107
-
108
-
An editable installation is recommended for most users. It will allow you to run GEOPHIRES-X locally,
109
-
view its Python files in an IDE or text editor,
110
-
and create your own extensions as described in `How to extend GEOPHIRES-X <docs/How-to-extend-GEOPHIRES-X.md#how-to-extend-geophires-x>`__.
111
-
112
-
Prerequisites:
113
-
114
-
1. Python 3.8+: You must have Python 3.8 or later installed on your machine. Python can be downloaded at `python.org/downloads <https://www.python.org/downloads/>`__. (On Ubuntu: ``alias python=python3`` if not aliased already.)
3. Virtual environment (aka ``virtualenv``): `Install virtual environment on your machine <https://virtualenv.pypa.io/en/latest/installation.html#via-pip>`__ if you don't have it already
117
-
4. On Windows, you will need Admin privileges (required to successfully activate the virtual environment)
118
-
119
-
Steps:
120
-
121
-
1. Open a command line (i.e. Terminal on Mac, PowerShell on Windows)
7. View and edit source code by opening the ``my-geophires-project/`` directory in an IDE or editor such as `PyCharm <https://www.jetbrains.com/pycharm/>`__, `Spyder <https://www.spyder-ide.org/>`__, or `Visual Studio Code <https://code.visualstudio.com/>`__. The GEOPHIRES-X source code will be located in the ``my-geophires-project/geophires-x`` directory. You can add your own python files in ``my-geophires-x/`` that use the source as a module as shown below.
153
-
154
-
To update the editable installation with the latest GEOPHIRES version::
155
-
156
-
cd geophires-x
157
-
git pull
158
-
# resolve merge conflicts, if any
159
-
pip install -e .
160
-
161
-
162
-
163
-
Usage
164
-
-----
165
-
166
-
Python
167
-
^^^^^^
168
-
169
-
Example usage in Python:
170
-
171
-
.. code:: python
172
-
173
-
from geophires_x_client import GeophiresXClient
174
-
from geophires_x_client.geophires_input_parameters import GeophiresInputParameters
175
-
176
-
client = GeophiresXClient()
177
-
result = client.get_geophires_result(
178
-
GeophiresInputParameters({
179
-
"Gradient 1": "69",
180
-
"Reservoir Depth": "5",
181
-
"End-Use Option": "1",
182
-
"Power Plant Type": "4"
183
-
})
184
-
)
185
-
186
-
withopen(result.output_file_path, 'r') as f:
187
-
print(f.read())
188
-
189
-
If you followed the editable installation example above, put this code in ``my-geophires-project/main.py``, then run::
190
-
191
-
python main.py
192
-
193
-
You will then see output including a case report::
194
-
195
-
(venv) ➜ my-geophires-project python main.py
196
-
No valid plant outlet pressure provided. GEOPHIRES will assume default plant outlet pressure (100 kPa)
197
-
No valid plant outlet pressure provided. GEOPHIRES will assume default plant outlet pressure (100 kPa)
198
-
199
-
*****************
200
-
***CASE REPORT***
201
-
*****************
202
-
203
-
Simulation Metadata
204
-
----------------------
205
-
GEOPHIRES Version: 3.4.42
206
-
Simulation Date: 2024-07-08
207
-
Simulation Time: 10:07
208
-
Calculation Time: 0.047 sec
209
-
210
-
***SUMMARY OF RESULTS***
211
-
212
-
End-Use Option: Electricity
213
-
Average Net Electricity Production: 23.94 MW
214
-
Electricity breakeven price: 5.04 cents/kWh
215
-
216
-
[...]
217
-
218
-
219
-
You may also pass parameters as a text file:
220
-
221
-
.. code:: python
222
-
223
-
from pathlib import Path
224
-
from geophires_x_client import GeophiresXClient
225
-
from geophires_x_client.geophires_input_parameters import GeophiresInputParameters
`test_geophires_x.py <tests/test_geophires_x.py>`__ has additional examples of how to consume and call `GeophiresXClient <src/geophires_x_client/__init__.py#L14>`__.
240
-
241
-
242
-
Command Line
243
-
^^^^^^^^^^^^
244
-
245
-
If you installed with pip (editable or non-), you may run GEOPHIRES from the command line, passing your input file as an argument::
246
-
247
-
python -mgeophires_x my_geophires_input.txt
248
-
249
-
You may also optionally pass the output file as well::
0 commit comments