-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add the transport tutorial #146
base: enh/run-clone
Are you sure you want to change the base?
Add the transport tutorial #146
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## enh/run-clone #146 +/- ##
=============================================
Coverage 87.1% 87.1%
=============================================
Files 231 231
Lines 8216 8216
=============================================
Hits 7160 7160
Misses 1056 1056 |
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.
Thanks for starting this work and outlining the structure you envision :)
I have cleaned up the notebook files, made formatting consistent, added some content where I thought it was needed, updated the syntax to fit our current API, and made the code comply with the mypy config.
This last step includes adding linopy to the dependencies. Unfortunately, linopy still doesn't support numpy 2.0, see PyPSA/linopy#386 and PyPSA/linopy#332, so this brings with it an effective numpy pin to < 2.0. I would like to avoid that, so I would not merge this PR right away.
Even more so since Volker previously indicated that linopy might not be the tool of choice for us since it doesn't support non-linear programming. I've opened PyPSA/linopy#384 to ask their maintainers about plans for that, but haven't received a reply yet.
On top of all this, I'm not sure why the codecov report says that all coverable lines are covered. It seems to me that this PR so far copies over the utility code for running the tutorials, but not the tests for the same, which should be a TODO:
- Add tests for the tutorials and their utility code
Not sure why mypy is still failing here. I bumped the version locally, which removed the linopy/numpy pin. So this latest commit might also break the usability of linopy, but poetry allowed this. |
0fa8580
to
16bc1e5
Compare
Thanks for your updates here, @danielhuppmann! I have reworked some of them, mainly in terms of formatting: we seem to have different preferences how to highlight things. I differentiate between names of tools and software, which I write like this, and vocabulary of our tool in particular, including function names and code object names, which I |
16bc1e5
to
4cc277d
Compare
"metadata": {}, | ||
"source": [ | ||
"You can check that the solution from [Notebook 1](1_transport-tutorial.ipynb) was indeed saved by inspecting an `ixmp4.Variable`. \n", | ||
"The `data` of any optimization object is stored internally as a dictionary." |
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.
Just noting here that this might change soon if the "Normalize Parameter DB storage" PR gets finished and accepted.
"## Cleaning up after doing this tutorial\n", | ||
"\n", | ||
"You can use the **ixmp4** Command Line Interface (CLI) to remove the database related to this tutorial.\n", | ||
"\n", | ||
"Run the following in the command-line:\n", | ||
"```\n", | ||
"ixmp4 platforms remove transport-tutorial\n", | ||
"```\n", | ||
"\n", | ||
"The prompt will ask whether you also want to delete the SQLite database file from your computer, answer `y` for a complete deletion." |
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.
Maybe by having this cell here, we can remove the almost identical ones in Notebook 0.
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.
Well, my thinking for having it twice is to show users that do something stupid during setup how to quickly restart - and then show how clean up at the end of the tutorial.
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.
Sure, we can also have it twice :)
This PR copies over the transport tutorial (with linopy) from #101 in a more streamlined manner. Most importantly, the term "tutorial" is now used for the entire thing consisting of three notebooks: