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

Simplify process to generate plotting documentation #307

Merged
merged 3 commits into from
Jun 21, 2021
Merged

Conversation

jenhagg
Copy link
Collaborator

@jenhagg jenhagg commented Jun 11, 2021

Purpose

The plots used on the docs website require specific scenarios as well as an environment to run the code snippets. The goal here is to simplify that as much as possible, so we can recreate the content as needed, e.g. to take advantage of new functionality.

What the code is doing

What's involved:

  • zip file with scenario data uploaded to blob storage
  • docker-compose file for self contained environment
  • notebook which generates the code used to run/save each code snippet

Testing

I ran the notebook and compared the results with currently checked in files. There are a few minor differences, but that is due to inconsistencies in the code snippets, which we can fix separately if needed.

Usage Example/Visuals

If github will render the notebook, that is probably the most useful place to look

Time estimate

20 min

@jenhagg jenhagg self-assigned this Jun 11, 2021
@jenhagg jenhagg requested a review from rouille June 11, 2021 00:26
@jenhagg jenhagg linked an issue Jun 11, 2021 that may be closed by this pull request
3 tasks

After copying the notebook url from the output, start the `run_snippets.ipynb` notebook
and run through it. For the most part, no interaction is required. The exception is any
bokeh plots which must be manually saved as png (currently only the powerflow snapshot).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can use the following:

from bokeh.io import export_png

export_png(plot, filename="plot.png")

to automatically save the plot as png

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Couple of issues.. we can get the plot object to pass in using curstate() if output_notebook() was called too, but the export also required pip install selenium, and after that I got an error that firefox isn't supported. At that point I gave up.

@rouille
Copy link
Collaborator

rouille commented Jun 11, 2021

Should we add a paragraph in index.rst that would explain how to download the zip file and spin up the container so users can run the code snippets? Plots would not be saved but would display only.

@rouille
Copy link
Collaborator

rouille commented Jun 11, 2021

Now that we have docs/run_snippets.ipynb, we probably don't need postreise/plot/demo/plot_tutorial.ipynb. Correct?

@jenhagg
Copy link
Collaborator Author

jenhagg commented Jun 11, 2021

Now that we have docs/run_snippets.ipynb, we probably don't need postreise/plot/demo/plot_tutorial.ipynb. Correct?

Might not hurt to have both.. the tutorial is more readable, while run_snippets is easier to run and save repeatedly. Maybe we could delete it down the road if it turns out we don't use it.

Copy link
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

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

Thanks

@jenhagg jenhagg merged commit 147c1de into develop Jun 21, 2021
@jenhagg jenhagg deleted the jon/plots branch June 21, 2021 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation including plots should be reproducible
2 participants