-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #307 from Breakthrough-Energy/jon/plots
Simplify process to generate plotting documentation
- Loading branch information
Showing
4 changed files
with
1,098 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,30 @@ | ||
This guide will demonstrate how to regenerate the plots used in the documentation here. | ||
The requirements are | ||
1) Have docker installed | ||
2) Download the [PlotData] zip file containing the scenarios used | ||
|
||
Next, extract the data to your home directory, or change the expected location in the | ||
docker-compose.yml file. | ||
|
||
|
||
Start the container, which will provide a notebook environment for running the code | ||
snippets. | ||
``` | ||
docker compose up | ||
``` | ||
|
||
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). | ||
|
||
One may notice that the first part of the notebook contains code to generate the cells | ||
used subsequently. This is due to (as far as I know) lack of support in jupyterlab for | ||
programmatically adding new cells, so as a result, any changes to the configuration may | ||
require a developer to rerun this part and copy/paste the output as needed. In most | ||
cases, one can simply run it with no changes, since the notebook is pre-populated. | ||
|
||
The output from each snippet will be saved in the `img2/` directory, similar to `img/` which | ||
is checked into git. From here, it's up to the user to compare results and commit the new plots if they look | ||
good. | ||
|
||
[PlotData]: https://besciences.blob.core.windows.net/snapshots/PlotData.zip |
This file contains 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,17 @@ | ||
version: '3.7' | ||
|
||
services: | ||
postreise: | ||
container_name: postreise | ||
hostname: postreise | ||
image: ghcr.io/breakthrough-energy/postreise:latest | ||
stdin_open: true # docker run -i | ||
tty: true # docker run -t | ||
working_dir: /app | ||
volumes: | ||
- ~/PlotData:/mnt/bes/pcm | ||
- ./:/app | ||
ports: | ||
- "10000:10000" | ||
environment: | ||
- DEPLOYMENT_MODE=1 |
This file contains 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,44 @@ | ||
mpl_config = { | ||
"single": { | ||
"curtailment_eastern": ( | ||
"curtailment_solar_eastern_ts.png", | ||
"curtailment_wind_eastern_ts.png", | ||
), | ||
"capacity_vs_cf_solar_western_scatter": "capacity_vs_cf_solar_western_scatter.png", | ||
"capacity_vs_cost_curve_slope_coal_eastern_scatter": "capacity_vs_cost_curve_slope_coal_eastern_scatter.png", | ||
"capacity_vs_curtailment_solar_western_scatter": "capacity_vs_curtailment_solar_western_scatter.png", | ||
"curtailment_usa_heatmap": "curtailment_usa_heatmap.png", | ||
"generation_stack_western_ts": "generation_stack_western_ts.png", | ||
}, | ||
"comp": { | ||
"capacity_vs_generation_bar": ( | ||
"capacity_vs_generation_ca_bar.png", | ||
"capacity_vs_generation_western_bar.png", | ||
), | ||
"capacity_vs_generation_pie": ( | ||
"capacity_vs_generation_wa_pie.png", | ||
"capacity_vs_generation_western_pie.png", | ||
), | ||
"energy_emission_stack_bar": "energy_emission_stack_bar.png", | ||
"shortfall_nv": "shortfall_nv.png", | ||
"emission_bar": "emission_bar.png", | ||
"shortfall_nv": "shortfall_nv.png", | ||
}, | ||
} | ||
|
||
bokeh_config = { | ||
"single": { | ||
"lmp_usa_map": "lmp_usa_map.html", | ||
"utilization_map": "utilization_map.html", | ||
"emission_map": "emission_map.html", | ||
"pf_snapshot_map": "pf_snapshot_map.png", | ||
}, | ||
"other": {"interconnection_map": "interconnection_map.html"}, | ||
"comp": {"emission_map_carbon_diff": "emission_map.html"}, | ||
} | ||
|
||
|
||
def save_matplotlib(result, filename): | ||
for i, output in enumerate(result.outputs): | ||
with open(filename[i], "wb") as f: | ||
f.write(output.data["image/png"]) |
Oops, something went wrong.