Skip to content

Commit

Permalink
Various enhancements (#13)
Browse files Browse the repository at this point in the history
- fix LCOT calculation (multiply OPEX with distance)
- add AC-DC loss to AEP calculation
- add distance to shore calculations
- fix redefined-outer-name in notebooks
- use subprocess.run instead of os.system
- update plots
- update leaflet map zoom
- generate PNG images for paper
- fix some docstings
- update docs/requirements.txt
- add GitHub workflow for building Sphinx Docs to host on GitHub Pages
- add amsmath, dollarmath to docs config
- update installation instructions
- update nbconvert command (use ClearOutputPreprocessor) and regenerate scripts
- update .pylintrc - disable pointless-statement, line-too-long
- update .gitignore
- update matplotlibrc
- update pyproject.toml
- update .vscode/tasks.json
  • Loading branch information
nmstreethran authored Aug 29, 2024
1 parent 8de0b27 commit fc0a7f4
Show file tree
Hide file tree
Showing 55 changed files with 3,677 additions and 931 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# https://www.sphinx-doc.org/en/master/tutorial/deploying.html
name: 'Sphinx: Render docs'

on:
push:
branches:
- 'main'
paths:
- 'docs/**'
- 'h2ss/**'
- 'tests/**'

jobs:
build:
runs-on: ubuntu-latest
# permissions:
# contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: docs/requirements.txt
- name: Install setup dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Install docs dependencies
run: python -m pip install -r docs/requirements.txt
- name: Make HTML
run: cd docs && make html
# - name: Build HTML
# uses: ammaraskar/sphinx-action@master
# with:
# pre-build-command: 'python -m pip install --upgrade pip setuptools wheel'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
36 changes: 26 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -27,8 +31,8 @@ share/python-wheels/
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

Expand Down Expand Up @@ -92,18 +96,18 @@ ipython_config.py
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
# Pipfile.lock
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.lock
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm.lock
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
Expand Down Expand Up @@ -153,11 +157,23 @@ dmypy.json
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python

data/*
temp/
Expand Down
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[MASTER]
init-hook="import sys; sys.path.append('.')"
ignore-paths=data/
disable=pointless-statement, line-too-long
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "convert-notebooks",
"type": "shell",
"command": "source .venv/bin/activate && ./convert-notebooks.sh",
"command": "source .venv/bin/activate && jupyter nbconvert --to script --ClearOutputPreprocessor.enabled=True docs/notebooks/*.ipynb && rm -rf scripts/* && mv docs/notebooks/*.py scripts",
"problemMatcher": [],
"group": {
"kind": "build"
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
{
"label": "pylint-scripts",
"label": "pylint-functions",
"type": "shell",
"command": "source .venv/bin/activate && pylint h2ss/*.py tests/*.py",
"problemMatcher": [],
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [2024.08.0](https://github.com/wind-to-hydrogen-toolkit/hydrogen-salt-storage/tree/2024.08.0)

[Various enhancements](https://github.com/wind-to-hydrogen-toolkit/hydrogen-salt-storage/pull/13) by @nmstreethran.
[**Full Changelog**](https://github.com/wind-to-hydrogen-toolkit/hydrogen-salt-storage/compare/2024.05.0...2024.08.0).

- fix LCOT calculation (multiply OPEX with distance)
- add AC-DC loss to AEP calculation
- add distance to shore calculations
- fix redefined-outer-name in notebooks
- use subprocess.run instead of os.system
- update plots
- update leaflet map zoom
- generate PNG images for paper
- fix some docstings
- update docs/requirements.txt
- add GitHub workflow for building Sphinx Docs to host on GitHub Pages
- add amsmath, dollarmath to docs config
- update installation instructions
- update nbconvert command (use ClearOutputPreprocessor) and regenerate scripts
- update .pylintrc - disable pointless-statement, line-too-long
- update .gitignore
- update matplotlibrc
- update pyproject.toml
- update .vscode/tasks.json

## [2024.05.0](https://github.com/wind-to-hydrogen-toolkit/hydrogen-salt-storage/tree/2024.05.0)

[Various enhancements](https://github.com/wind-to-hydrogen-toolkit/hydrogen-salt-storage/pull/12) by @nmstreethran.
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ keywords:
- hydrogen economy in Ireland
- geological storage
license: Apache-2.0
version: 2024.05.0
version: 2024.08.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Create a virtual environment and install all requirements:
```sh
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
```

Expand All @@ -39,7 +39,7 @@ python -m pytest --cov
```sh
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install https://github.com/wind-to-hydrogen-toolkit/hydrogen-salt-storage/archive/refs/heads/main.zip
```

Expand Down
17 changes: 0 additions & 17 deletions convert-notebooks.sh

This file was deleted.

10 changes: 6 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@

viewcode_line_numbers = True

# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
myst_enable_extensions = [
"amsmath",
"dollarmath",
]

# templates_path = ["_templates"]

exclude_patterns = [
Expand Down Expand Up @@ -69,10 +75,6 @@
}
],
"navbar_align": "right",
"secondary_sidebar_items": {
"datasets": [],
"map": [],
},
}

html_sidebars = {
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Create a virtual environment and install all requirements:
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
Run tests:
Expand Down
428 changes: 214 additions & 214 deletions docs/map.ipynb

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions docs/notebooks/bathymetry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
"outputs": [],
"source": [
"plt.rcParams[\"xtick.major.size\"] = 0\n",
"plt.rcParams[\"ytick.major.size\"] = 0\n",
"plt.rcParams[\"xtick.minor.size\"] = 0\n",
"plt.rcParams[\"ytick.minor.size\"] = 0"
"plt.rcParams[\"ytick.major.size\"] = 0"
]
},
{
Expand Down Expand Up @@ -2851,7 +2849,7 @@
"outputs": [],
"source": [
"bath = rd.bathymetry_layer(\n",
" dat_extent=extent,\n",
" dat_extent=extent.buffer(3000),\n",
" bathymetry_path=os.path.join(\"data\", \"bathymetry\"),\n",
")"
]
Expand All @@ -2876,7 +2874,7 @@
],
"source": [
"plt.figure(figsize=(10, 7))\n",
"ax = plt.axes(projection=ccrs.epsg(rd.CRS))\n",
"ax2 = plt.axes(projection=ccrs.epsg(rd.CRS))\n",
"bath[\"elevation\"].plot.contourf(cmap=\"mako\", levels=10, robust=True)\n",
"CS = bath[\"elevation\"].plot.contour(\n",
" # colors=\"darkslategrey\",\n",
Expand All @@ -2888,9 +2886,9 @@
" robust=True,\n",
")\n",
"plt.clabel(CS, inline=True)\n",
"cx.add_basemap(ax, source=cx.providers.CartoDB.VoyagerNoLabels, crs=rd.CRS)\n",
"cx.add_basemap(ax, source=cx.providers.CartoDB.VoyagerOnlyLabels, crs=rd.CRS)\n",
"ax.gridlines(\n",
"cx.add_basemap(ax2, source=cx.providers.CartoDB.VoyagerNoLabels, crs=rd.CRS)\n",
"cx.add_basemap(ax2, source=cx.providers.CartoDB.VoyagerOnlyLabels, crs=rd.CRS)\n",
"ax2.gridlines(\n",
" draw_labels={\"bottom\": \"x\", \"left\": \"y\"},\n",
" alpha=0.25,\n",
" color=\"darkslategrey\",\n",
Expand Down
4 changes: 1 addition & 3 deletions docs/notebooks/frequent_shipping_routes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
"outputs": [],
"source": [
"plt.rcParams[\"xtick.major.size\"] = 0\n",
"plt.rcParams[\"ytick.major.size\"] = 0\n",
"plt.rcParams[\"xtick.minor.size\"] = 0\n",
"plt.rcParams[\"ytick.minor.size\"] = 0"
"plt.rcParams[\"ytick.major.size\"] = 0"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions docs/notebooks/ireland_boundary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"outputs": [],
"source": [
"plt.rcParams[\"xtick.major.size\"] = 0\n",
"plt.rcParams[\"ytick.major.size\"] = 0\n",
"plt.rcParams[\"xtick.minor.size\"] = 0\n",
"plt.rcParams[\"ytick.minor.size\"] = 0"
"plt.rcParams[\"ytick.major.size\"] = 0"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions docs/notebooks/kish_basin_caverns.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
"outputs": [],
"source": [
"plt.rcParams[\"xtick.major.size\"] = 0\n",
"plt.rcParams[\"ytick.major.size\"] = 0\n",
"plt.rcParams[\"xtick.minor.size\"] = 0\n",
"plt.rcParams[\"ytick.minor.size\"] = 0"
"plt.rcParams[\"ytick.major.size\"] = 0"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/notebooks/kish_basin_caverns_capacity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@
" alpha=0.25,\n",
" color=\"darkslategrey\",\n",
" xlabel_style={\"fontsize\": fontsize},\n",
" ylabel_style={\"fontsize\": fontsize, \"rotation\": 90},\n",
" ylabel_style={\"fontsize\": fontsize, \"rotation\": 89.9},\n",
" xformatter=LongitudeFormatter(auto_hide=False, dms=True),\n",
" yformatter=LatitudeFormatter(auto_hide=False, dms=True),\n",
" )\n",
Expand All @@ -1562,8 +1562,8 @@
"\n",
" plt.tight_layout()\n",
" # plt.savefig(\n",
" # os.path.join(\"graphics\", \"fig_caverns_capacity.jpg\"),\n",
" # format=\"jpg\",\n",
" # os.path.join(\"graphics\", \"Figure_8.png\"),\n",
" # format=\"png\",\n",
" # dpi=600,\n",
" # )\n",
" plt.show()"
Expand Down Expand Up @@ -1610,7 +1610,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0rc1"
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions docs/notebooks/kish_basin_caverns_height.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@
" alpha=0.25,\n",
" color=\"darkslategrey\",\n",
" xlabel_style={\"fontsize\": fontsize},\n",
" ylabel_style={\"fontsize\": fontsize, \"rotation\": 90},\n",
" ylabel_style={\"fontsize\": fontsize, \"rotation\": 89.9},\n",
" xformatter=LongitudeFormatter(auto_hide=False, dms=True),\n",
" yformatter=LatitudeFormatter(auto_hide=False, dms=True),\n",
" )\n",
Expand All @@ -1838,8 +1838,8 @@
"\n",
" plt.tight_layout()\n",
" # plt.savefig(\n",
" # os.path.join(\"graphics\", \"fig_caverns_capacity_height.jpg\"),\n",
" # format=\"jpg\",\n",
" # os.path.join(\"graphics\", \"Figure_7.png\"),\n",
" # format=\"png\",\n",
" # dpi=600,\n",
" # )\n",
" plt.show()"
Expand Down Expand Up @@ -1884,7 +1884,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0rc1"
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
4 changes: 1 addition & 3 deletions docs/notebooks/kish_basin_dat_files.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
"outputs": [],
"source": [
"plt.rcParams[\"xtick.major.size\"] = 0\n",
"plt.rcParams[\"ytick.major.size\"] = 0\n",
"plt.rcParams[\"xtick.minor.size\"] = 0\n",
"plt.rcParams[\"ytick.minor.size\"] = 0"
"plt.rcParams[\"ytick.major.size\"] = 0"
]
},
{
Expand Down
Loading

0 comments on commit fc0a7f4

Please sign in to comment.