Skip to content

Commit 5dd2680

Browse files
Merge pull request NREL#396 from softwareengineerprogrammer/main
Move Getting Started to separate documentation page; MPF Gringarten name [v3.9.29]
2 parents f1fbfce + 4868ca1 commit 5dd2680

40 files changed

+355
-305
lines changed

.bumpversion.cfg

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[bumpversion]
2-
current_version = 3.9.28
2+
current_version = 3.9.29
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<prerelease_label>[a-z]+)\.(?P<prerelease>\d+))?
6-
serialize =
6+
serialize =
77
{major}.{minor}.{patch}-{prerelease_label}.{prerelease}
88
{major}.{minor}.{patch}
99

@@ -12,7 +12,7 @@ first_value = 0
1212

1313
[bumpversion:part:prerelease_label]
1414
optional_value = rc
15-
values =
15+
values =
1616
alpha
1717
beta
1818
rc
@@ -30,8 +30,10 @@ search = /v{current_version}...main
3030
replace = /v{new_version}...main
3131

3232
[bumpversion:file:docs/conf.py]
33-
search = version = release = '{current_version}'
34-
replace = version = release = '{new_version}'
33+
search = version = '{current_version}'
34+
release = '{current_version}'
35+
replace = version = '{new_version}'
36+
release = '{new_version}'
3537

3638
[bumpversion:file:src/geophires_x/__init__.py]
3739
search = __version__ = '{current_version}'
@@ -40,3 +42,6 @@ replace = __version__ = '{new_version}'
4042
[bumpversion:file:.cookiecutterrc]
4143
search = version: {current_version}
4244
replace = version: {new_version}
45+
46+
[bumpversion:part:release]
47+
# Enables the 'bumpversion release' command to drop pre-release suffixes.

.cookiecutterrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ default_context:
5454
sphinx_doctest: "no"
5555
sphinx_theme: "sphinx-py3doc-enhanced-theme"
5656
test_matrix_separate_coverage: "no"
57-
version: 3.9.28
57+
version: 3.9.29
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

CONTRIBUTING.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,20 @@ Then push both commits and tags to your fork:
278278
Writing objects: 100% (1/1), 205 bytes | 205.00 KiB/s, done.
279279
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
280280
To github.com:softwareengineerprogrammer/python-geophires-x-nrel.git
281-
* [new tag] v3.2.3 -> v3.2.3
281+
* [new tag] v3.2.3-alpha.0 -> v3.2.3-alpha.0
282+
283+
Once the alpha version builds successfully in GitHubActions and you're ready to release it as v3.2.3:
284+
285+
.. code-block::
286+
287+
(venv) ➜ python-geophires-x git:(main) bumpversion release
288+
(venv) ➜ python-geophires-x git:(main) git push && git push fork --tags
282289
283290
Once a version bump is merged into the main repository with a Pull Request, tags must be manually pushed (GitHub `doesn't include tags in PRs <https://stackoverflow.com/questions/12278660/adding-tags-to-a-pull-request>`__):
284291

285292
.. code-block::
286293
287-
(venv) ➜ python-geophires-x git:(main) git push origin --tags
294+
(venv) ➜ python-geophires-x git:(main) git push origin tag v3.2.3
288295
289296
290297
Documentation Updates

INSTALL.rst

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
Getting Started
2+
===============
3+
4+
Web Interface
5+
-------------
6+
7+
A web interface is available at `gtp.scientificwebservices.com/geophires <https://gtp.scientificwebservices.com/geophires>`__.
8+
9+
The short URL `bit.ly/geophires <https://bit.ly/geophires>`__ redirects to the same location.
10+
11+
Installation
12+
------------
13+
14+
Pip Package
15+
^^^^^^^^^^^
16+
17+
If you do not need to view or edit GEOPHIRES-X source code, you can consume GEOPHIRES-X as a regular, non-editable python package::
18+
19+
pip3 install https://github.com/NREL/GEOPHIRES-X/archive/main.zip
20+
21+
22+
.. (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.)
35+
2. `Git <https://git-scm.com/book/en/v2/Getting-Started-Installing-Git>`__
36+
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)
42+
2. Create a directory for GEOPHIRES::
43+
44+
mkdir my-geophires-project
45+
cd my-geophires-project
46+
47+
3. Create a virtual environment::
48+
49+
python -m venv venv
50+
51+
4. Source the virtual environment:
52+
53+
- Windows::
54+
55+
venv\Scripts\activate
56+
57+
- macOS/Linux::
58+
59+
source venv/bin/activate
60+
61+
5. Install the ``geophires-x`` package::
62+
63+
pip3 install -e git+https://github.com/NREL/GEOPHIRES-X.git#egg=geophires-x --src .
64+
65+
6. Run on an example file::
66+
67+
cd geophires-x
68+
cd tests
69+
cd examples
70+
python -mgeophires_x example1.txt
71+
72+
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+
with open(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
146+
147+
# https://github.com/NREL/GEOPHIRES-X/blob/main/tests/examples/example1.txt
148+
example_file_path = Path('geophires-x/tests/examples/example1.txt').absolute()
149+
150+
client = GeophiresXClient()
151+
result = client.get_geophires_result(
152+
GeophiresInputParameters(from_file_path=example_file_path)
153+
)
154+
155+
with open(result.output_file_path, 'r') as f:
156+
print(f.read())
157+
158+
159+
`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::
170+
171+
python -mgeophires_x my_geophires_input.txt my_geophires_result.out
172+
173+
(If you do not pass an output file argument a default name will be used.)

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include AUTHORS.rst
1818
include CHANGELOG.rst
1919
include CONTRIBUTING.rst
2020
include LICENSE
21+
include INSTALL.rst
2122
include README.rst
2223
include How-to-extend-GEOPHIRES-X.md
2324
include geophires-logo.png

0 commit comments

Comments
 (0)