Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,10 @@ docs/cables/Figs
# Pycharm
.idea/

# Other
# ORBIT-specific
Analysis/
examples/configs/array_system.yaml
examples/configs/export_system.yaml
examples/configs/mooring_system.yaml
examples/configs/oss.yaml
examples/configs/substructure.yaml
1 change: 0 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ execute:
- Thumbs.db
- DS_Store
- "**.ipynb_checkpoints"
- "topical_guides/cost_curves.md"

# Define the name of the latex output file for PDF builds
latex:
Expand Down
1 change: 1 addition & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ parts:
- file: topical_guides/custom_array
- file: topical_guides/export_cable_system
- file: topical_guides/cable_installation
- file: topical_guides/cost_curves
- caption: API Reference
chapters:
- file: api/ProjectManager
Expand Down
16 changes: 13 additions & 3 deletions docs/build_book.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
rm -rf _build
jupyter-book build .
cp -f _build/jupyter_execute/tutorials/*.ipynb ../examples/
cp -f _build/jupyter_execute/topical_guides/*.ipynb ../examples/
jupyter-book build . > build_log.txt

cp -f _build/jupyter_execute/**/*.ipynb ../examples/
nb_file_names=$(find _build/jupyter_execute/**/*.ipynb -type f | awk -F/ 'BEGIN {ORS=" "} {print $NF}')

cd ../examples
python ../docs/clean_notebook.py $nb_file_names
pre-commit run --files $nb_file_names

cd ../docs
printf "\nORBIT documentation built succesfully, and updated examples have been copied into ORBIT/examples/ and validated\n"
tail -n 15 build_log.txt
rm -rf build_log.txt
34 changes: 34 additions & 0 deletions docs/clean_notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Removes all outputs and metadata in the Jupyter Notebook examples that
cause painful diffs during code contribution and review time.
"""

import sys
from pathlib import Path

import nbformat as nbf


def remove_extraneous(notebook_fn: str | Path):
"""Delete outputs and metadata from Jupyter Notebook files."""
if isinstance(notebook_fn, str):
notebook_fn = Path(notebook_fn)
with notebook_fn.open("r", encoding="utf-8") as f:
notebook = nbf.read(f, as_version=4)

for cell in notebook["cells"]:
if cell["cell_type"] in ["code", "markdown"]:
cell["metadata"] = {}

with notebook_fn.open("w", encoding="utf-8") as f:
nbf.write(notebook, f)


if __name__ == "__main__":
if len(sys.argv) < 2:
print("No files provided")
sys.exit(1)
for fn in sys.argv[1:]:
if not fn.endswith(".ipynb"):
print(f"Skipping non-notebook file: {fn}")
continue
remove_extraneous(fn)
2 changes: 1 addition & 1 deletion docs/methods/CommonCost.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and it shows the `Class`, `attribute_name`, `units`, and the cost value in 2024
future releases, these costs will adjust based on the market indices so any user
can be sure that the common costs in their model is not outdated.

:::{figure} ../imagesimages/cost_by_procurement.png
:::{figure} ../images/cost_by_procurement.png
:align: center

Cost by Procurement Year. Note that values are inflated from the procurement year USD to 2024 USD using CPI
Expand Down
Loading
Loading