-
Notifications
You must be signed in to change notification settings - Fork 27
Docs: Convert notebooks to scripts and executable markdown #464
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
Merged
johnjasa
merged 27 commits into
NatLabRockies:develop
from
RHammond2:docs/convert-notebooks
Jan 27, 2026
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4ba397b
replace docs notebooks with executable markdown for simple diffs
RHammond2 e635d77
add notebook conversion commentary
RHammond2 63bd3b3
update changelog
RHammond2 f0e7c89
update gitignore for notebook output
RHammond2 7520031
add _autosummary to gitignore
RHammond2 7ae1e8c
merge develop and fix conflict
RHammond2 2400d58
replace the example notebook with basic script and move the demo to t…
RHammond2 8b9a463
update changelog
RHammond2 ca8744a
update markdown formatting
RHammond2 5e8fa96
near complete revamp of run_csv_doe.ipynb
RHammond2 191151a
get doe example working
RHammond2 10afdb1
replace notebook with Python script
RHammond2 a24cd48
update bad import
RHammond2 acdb6eb
update gitignore for DOE driver configs
RHammond2 84c9035
run example from top
RHammond2 9d80ba0
replace sizing notebook with executable markdown, and get it running
RHammond2 6ab26f5
add sphinx flag to ensure failed executable cells cause a build error
RHammond2 eed568b
remove cases.sql parent directory output data
RHammond2 43be359
convert notebook to script, stripping much of the narrative
RHammond2 cb3f901
update changelog
RHammond2 afe6e25
add \ in front of $ to avoid latex in markdown
RHammond2 9582cd4
Merge branch 'develop' into docs/convert-notebooks
RHammond2 b7de54f
merge develop and resolve conflicts
RHammond2 7df32f3
update docs example for updated example
RHammond2 bee5074
Merge branch 'develop' into docs/convert-notebooks
RHammond2 aee829d
Merge branch 'develop' into docs/convert-notebooks
johnjasa 636acc5
Updated literal lincludes for yamls in docs
johnjasa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| --- | ||
| jupytext: | ||
| text_representation: | ||
| extension: .md | ||
| format_name: myst | ||
| format_version: 0.13 | ||
| jupytext_version: 1.18.1 | ||
| kernelspec: | ||
| display_name: native-ard-h2i | ||
| language: python | ||
| name: python3 | ||
| --- | ||
|
|
||
| # Open-Loop Storage Controllers Demonstrations | ||
|
|
||
| ```{code-cell} ipython3 | ||
| from pathlib import Path | ||
| from matplotlib import pyplot as plt | ||
| from h2integrate.core.h2integrate_model import H2IntegrateModel | ||
| ``` | ||
|
|
||
| ## Hydrogen Dispatch | ||
|
|
||
| The following example is an expanded form of `examples/14_wind_hydrogen_dispatch`. | ||
|
|
||
| Here, we're highlighting the dispatch controller setup from | ||
| `examples/14_wind_hydrogen_dispatch/inputs/tech_config.yaml`. Please note some sections are removed | ||
| simply to highlight the controller sections | ||
|
|
||
| ```{literalinclude} ../../examples/14_wind_hydrogen_dispatch/inputs/tech_config.yaml | ||
| :language: yaml | ||
| :lineno-start: 54 | ||
| :linenos: true | ||
| :lines: 54,59-61,67-74 | ||
| ``` | ||
|
|
||
| Using the primary configuration, we can create, run, and postprocess an H2Integrate model. | ||
|
|
||
| ```{code-cell} ipython3 | ||
| # Create an H2Integrate model | ||
| model = H2IntegrateModel(Path("../../examples/14_wind_hydrogen_dispatch/inputs/h2i_wind_to_h2_storage.yaml")) | ||
|
|
||
| # Run the model | ||
| model.run() | ||
| model.post_process() | ||
| ``` | ||
|
|
||
| Now, we can visualize the demand profiles over time. | ||
|
|
||
| ```{code-cell} ipython3 | ||
| fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True, figsize=(8, 6), layout="tight") | ||
|
|
||
| start_hour = 0 | ||
| end_hour = 200 | ||
| total_time_steps = model.prob.get_val("h2_storage.hydrogen_soc").size | ||
| demand_profile = [ | ||
| model.technology_config["technologies"]["h2_storage"]["model_inputs"]["control_parameters"][ | ||
| "demand_profile" | ||
| ] | ||
| * 1e-3 | ||
| ] * total_time_steps | ||
| xvals = list(range(start_hour, end_hour)) | ||
|
|
||
| ax1.plot( | ||
| xvals, | ||
| model.prob.get_val("h2_storage.hydrogen_soc", units="percent")[start_hour:end_hour], | ||
| label="SOC", | ||
| ) | ||
| ax2.plot( | ||
| xvals, | ||
| model.prob.get_val("h2_storage.hydrogen_in", units="t/h")[start_hour:end_hour], | ||
| linestyle="-", | ||
| label="H$_2$ Produced (kg)", | ||
| ) | ||
| ax2.plot( | ||
| xvals, | ||
| model.prob.get_val("h2_storage.hydrogen_unused_commodity", units="t/h")[start_hour:end_hour], | ||
| linestyle=":", | ||
| label="H$_2$ Unused (kg)", | ||
| ) | ||
| ax2.plot( | ||
| xvals, | ||
| model.prob.get_val("h2_storage.hydrogen_unmet_demand", units="t/h")[start_hour:end_hour], | ||
| linestyle=":", | ||
| label="H$_2$ Unmet Demand (kg)", | ||
| ) | ||
| ax2.plot( | ||
| xvals, | ||
| model.prob.get_val("h2_storage.hydrogen_out", units="t/h")[start_hour:end_hour], | ||
| linestyle="-", | ||
| label="H$_2$ Delivered (kg)", | ||
| ) | ||
| ax2.plot( | ||
| xvals, | ||
| demand_profile[start_hour:end_hour], | ||
| linestyle="--", | ||
| label="H$_2$ Demand (kg)", | ||
| ) | ||
|
|
||
| ax1.set_ylabel("SOC (%)") | ||
| ax1.grid() | ||
| ax1.set_axisbelow(True) | ||
| ax1.set_xlim(0, 200) | ||
| ax1.set_ylim(0, 50) | ||
|
|
||
| ax2.set_ylabel("H$_2$ Hourly (t)") | ||
| ax2.set_xlabel("Timestep (hr)") | ||
| ax2.grid() | ||
| ax2.set_axisbelow(True) | ||
| ax2.set_ylim(0, 20) | ||
| ax2.set_yticks(range(0, 21, 2)) | ||
|
|
||
| plt.legend(ncol=3) | ||
| fig.show() | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aw yeah, this is the secret sauce that will help us avoid defunct yaml depictions in the docs! Love it, will highlight in the standup.