Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI; documentation updates; parameter range exception handling #66

Merged
merged 27 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8195aa7
Bumpversion extras_require entry
softwareengineerprogrammer Nov 12, 2023
13c7ed9
Merge branch 'NREL:main' into main
softwareengineerprogrammer Nov 13, 2023
fafa8da
Prepare docs redirect for GEOPHIRES-X repo rename (https://github.com…
softwareengineerprogrammer Nov 13, 2023
63d34f9
Merge branch 'NREL:main' into main
softwareengineerprogrammer Nov 13, 2023
1105650
Bump version: 3.2.5 → 3.2.6
softwareengineerprogrammer Nov 14, 2023
9162686
Test client input with non-default units (relevant to https://github.…
softwareengineerprogrammer Nov 14, 2023
3914a6a
Raise ValueError instead of sys.exit when parameter outside range
softwareengineerprogrammer Nov 14, 2023
ff1cc9b
Bump version: 3.2.6 → 3.2.7
softwareengineerprogrammer Nov 14, 2023
36d990b
Use module version in output
softwareengineerprogrammer Nov 17, 2023
c63dc66
Merge branch 'NREL:main' into main
softwareengineerprogrammer Nov 17, 2023
20fb966
Changelog minor versions
softwareengineerprogrammer Nov 17, 2023
3e7f22a
Merge branch 'NREL:main' into main
softwareengineerprogrammer Nov 18, 2023
143c176
VS code contributing instructions
softwareengineerprogrammer Nov 22, 2023
1789b4e
__main__.py to simplify calling from CLI; corresponding updates to RE…
softwareengineerprogrammer Nov 22, 2023
89380b2
Merge branch 'NREL:main' into main
softwareengineerprogrammer Nov 22, 2023
f89e7fe
Remove incorrect test code comment
softwareengineerprogrammer Nov 22, 2023
166bcab
Bump version: 3.2.7 → 3.2.8
softwareengineerprogrammer Nov 22, 2023
e1521d6
example13.txt in readme
softwareengineerprogrammer Nov 23, 2023
38aeaf9
Parse CLI args with argparse
softwareengineerprogrammer Nov 24, 2023
5d09215
Enable pypy311 test
softwareengineerprogrammer Nov 24, 2023
715e321
Specify pypy test os (ubuntu-latest)
softwareengineerprogrammer Nov 24, 2023
691b28a
'PyPy version 3.11 (x) with arch x64 not found' - try 3.9 instead
softwareengineerprogrammer Nov 24, 2023
dc2fe4c
See if mac pypy suffers from same scipy openblas issue
softwareengineerprogrammer Nov 24, 2023
48aee09
Mac pypy fails on another compiler issue, disable it for now
softwareengineerprogrammer Nov 24, 2023
64273bb
Remove unused CodeFromWanju.py and requirements.txt
softwareengineerprogrammer Nov 24, 2023
950e939
Update Wanju_Yuan_Closed-Loop_Geothermal_Energy_Recovery output and i…
softwareengineerprogrammer Nov 30, 2023
3c79eae
Allow almost-equal fallback for Wanju case since it apparently deviat…
softwareengineerprogrammer Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.2.5
current_version = 3.2.8
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ default_context:
sphinx_doctest: "no"
sphinx_theme: "sphinx-py3doc-enhanced-theme"
test_matrix_separate_coverage: "no"
version: 3.2.5
version: 3.2.8
version_manager: "bump2version"
website: "https://github.com/NREL"
year_from: "2023"
Expand Down
19 changes: 17 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@
Changelog
=========

GEOPHIRES-X (3.0) (2023)
GEOPHIRES-X (2023)
------------------------

3.2
^^^
Bug fixes

`diff <https://github.com/NREL/python-geophires-x/compare/v3.1.0...v3.2.0>`__

3.1
^^^
Internal changes to support unit testing

`diff <https://github.com/NREL/python-geophires-x/compare/v3.0.0...v3.1.0>`__


3.0
^^^
- New repository: https://github.com/NREL/python-geophires-x
- Ported from `malcolm-dsider/GEOPHIRES-X <https://github.com/malcolm-dsider/GEOPHIRES-X>`_ and `softwareengineerprogrammer/python-geophires-x <https://github.com/softwareengineerprogrammer/python-geophires-x>`_ using `ionelmc/cookiecutter-pylibrary <https://github.com/ionelmc/cookiecutter-pylibrary/>`_.
- https://github.com/NREL/python-geophires-x
- Releases now marked with tags/version metadata generated with ``bumpversion``

2.0 (2019)
Expand Down
12 changes: 7 additions & 5 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ To run all the test environments in *parallel*::
tox -p auto


Test Configuration in VS Code
-----------------------------
VS Code
-------

``.vscode/settings.json`` (macos):
``.vscode/settings.json`` (macOS):

.. code-block::

Expand All @@ -190,7 +190,7 @@ Test Configuration in VS Code
}


``.vscode/settings.json`` (windows):
``.vscode/settings.json`` (Windows):

.. code-block::

Expand Down Expand Up @@ -221,7 +221,9 @@ Test Configuration in VS Code
"python.languageServer": "Pylance",
}

Example running example file from the terminal: ``python 'C:\Users\kbeckers\Desktop\NREL\GitHub\python-geophires-x-nrel\src\geophires_x\GEOPHIRESv3.py' C:\Users\kbeckers\Desktop\NREL\GitHub\python-geophires-x-nrel\tests\examples\example1.txt``
Example running example file from the terminal::

python src\geophires_x\GEOPHIRESv3.py tests\examples\example1.txt

Version Management
------------------
Expand Down
53 changes: 46 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Free software: `MIT license <LICENSE>`__
:alt: Supported implementations
:target: https://pypi.org/project/geophires-x

.. |commits-since| image:: https://img.shields.io/github/commits-since/NREL/python-geophires-x/v3.2.5.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/NREL/python-geophires-x/v3.2.8.svg
:alt: Commits since latest release
:target: https://github.com/NREL/python-geophires-x/compare/v3.2.5...main
:target: https://github.com/NREL/python-geophires-x/compare/v3.2.8...main

.. |docs| image:: https://readthedocs.org/projects/python-geophires-x/badge/?style=flat
:target: https://nrel.github.io/python-geophires-x
Expand Down Expand Up @@ -87,7 +87,11 @@ follow `the Development instructions <CONTRIBUTING.rst#development>`__ instead.

Usage
-----
Example usage:

Python
^^^^^^

Example usage in Python:

.. code:: python

Expand All @@ -111,8 +115,6 @@ Example usage:
with open(result.output_file_path,'r') as f:
print(f.read())

Available parameters are documented in the `Parameters Reference <https://nrel.github.io/python-geophires-x/parameters.html>`__.

You may also pass parameters as a text file:

.. code:: python
Expand All @@ -133,10 +135,47 @@ You may also pass parameters as a text file:
print(f.read())


A variety of examples input ``.txt`` files are available in the `tests/examples directory of the repository <tests/examples>`__.

`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>`__.

Command Line
^^^^^^^^^^^^

If you installed with pip, you may run GEOPHIRES from the command line, passing your input file as an argument::

python -mgeophires_x my_geophires_input.txt

Parameters
^^^^^^^^^^

Available parameters are documented in the `Parameters Reference <https://nrel.github.io/python-geophires-x/parameters.html>`__.

Examples
^^^^^^^^

A variety of example input ``.txt`` files are available in the `tests/examples directory of the repository <tests/examples>`__:

- `example1.txt <tests/examples/example1.txt>`__
- `example1_addons.txt <tests/examples/example1_addons.txt>`__
- `example2.txt <tests/examples/example2.txt>`__
- `example3.txt <tests/examples/example3.txt>`__
- `example4.txt <tests/examples/example4.txt>`__
- `example5.txt <tests/examples/example5.txt>`__
- `example8.txt <tests/examples/example8.txt>`__
- `example9.txt <tests/examples/example9.txt>`__
- `example10_HP.txt <tests/examples/example10_HP.txt>`__
- `example11_AC.txt <tests/examples/example11_AC.txt>`__
- `example12_DH.txt <tests/examples/example12_DH.txt>`__
- `example13.txt <tests/examples/example13.txt>`__
- `Beckers_et_al_2023_Tabulated_Database_Coaxial_sCO2_heat.txt <tests/examples/Beckers_et_al_2023_Tabulated_Database_Coaxial_sCO2_heat.txt>`__
- `Beckers_et_al_2023_Tabulated_Database_Coaxial_water_heat.txt <tests/examples/Beckers_et_al_2023_Tabulated_Database_Coaxial_water_heat.txt>`__
- `Beckers_et_al_2023_Tabulated_Database_Uloop_sCO2_elec.txt <tests/examples/Beckers_et_al_2023_Tabulated_Database_Uloop_sCO2_elec.txt>`__
- `Beckers_et_al_2023_Tabulated_Database_Uloop_sCO2_heat.txt <tests/examples/Beckers_et_al_2023_Tabulated_Database_Uloop_sCO2_heat.txt>`__
- `Beckers_et_al_2023_Tabulated_Database_Uloop_water_elec.txt <tests/examples/Beckers_et_al_2023_Tabulated_Database_Uloop_water_elec.txt>`__
- `Beckers_et_al_2023_Tabulated_Database_Uloop_water_heat.txt <tests/examples/Beckers_et_al_2023_Tabulated_Database_Uloop_water_heat.txt>`__
- `SUTRAExample1.txt <tests/examples/SUTRAExample1.txt>`__
- `example_multiple_gradients.txt <tests/examples/example_multiple_gradients.txt>`__


Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO add running MC & HIP RA - #69

Documentation
=============

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
year = '2023'
author = 'NREL'
copyright = f'{year}, {author}'
version = release = '3.2.5'
version = release = '3.2.8'

pygments_style = 'trac'
templates_path = ['./templates']
Expand Down
18 changes: 10 additions & 8 deletions docs/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
<script type="text/javascript">
console.debug('Referrer:', document.referrer)

if (location.href.indexOf("nrel.github.io/python-geophires-x") !== -1
&& document.referrer.indexOf("https://github.com/softwareengineerprogrammer/python-geophires-x") !== -1) {
/* Redirect links from fork's GitHub docs to fork's docs deployment */
location.href = location.href.replace(
"nrel.github.io/python-geophires-x",
"softwareengineerprogrammer.github.io/python-geophires-x-nrel"
)
}
['python-geophires-x', 'GEOPHIRES-X'].map((repositoryName) => {
if (location.href.indexOf(`nrel.github.io/${repositoryName}`) !== -1
&& document.referrer.indexOf(`https://github.com/softwareengineerprogrammer/${repositoryName}`) !== -1) {
/* Redirect links from fork's GitHub docs to fork's docs deployment */
location.href = location.href.replace(
`nrel.github.io/${repositoryName}`,
`softwareengineerprogrammer.github.io/${repositoryName}`
)
}
})
</script>
{% endblock %}
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read(*names, **kwargs):

setup(
name='geophires-x',
version='3.2.5',
version='3.2.8',
license='MIT',
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
long_description='{}\n{}'.format(
Expand Down Expand Up @@ -80,5 +80,6 @@ def read(*names, **kwargs):
# eg:
# "rst": ["docutils>=0.11"],
# ":python_version=="2.6"": ["argparse"],
'development': ['bumpversion']
},
)
4 changes: 3 additions & 1 deletion src/geophires_x/AGSOutputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import sys
import traceback

import geophires_x

from .Parameter import ConvertUnitsBack, ConvertOutputUnits
from .OptionList import EndUseOptions, EconomicModel
from .Units import *
Expand Down Expand Up @@ -83,7 +85,7 @@ def PrintOutputs(self, model: Model):
f.write(NL)
f.write("Simulation Metadata\n")
f.write("----------------------\n")
f.write(" GEOPHIRES Version: 3.0\n")
f.write(f' GEOPHIRES Version: {geophires_x.__version__}\n')
f.write(" GEOPHIRES Build Date: 2022-06-30\n")
f.write(" Simulation Date: " + datetime.datetime.now().strftime("%Y-%m-%d\n"))
f.write(" Simulation Time: " + datetime.datetime.now().strftime("%H:%M\n"))
Expand Down
Loading