Skip to content

Commit

Permalink
Merge pull request #385 from Breakthrough-Energy/develop
Browse files Browse the repository at this point in the history
Merge develop into master for 0.5.3 release
  • Loading branch information
rouille authored Dec 16, 2022
2 parents 3568f49 + c560aa6 commit 53d9c91
Show file tree
Hide file tree
Showing 49 changed files with 1,824 additions and 1,063 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

name: Generate coverage report
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip_ci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: python -m pip install --upgrade tox
- run: tox -e checkformatting
flake8:
if: "!contains(github.event.head_commit.message, 'skip_ci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: python -m pip install --upgrade tox
- run: tox -e flake8
2 changes: 1 addition & 1 deletion .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Pipenv lock
id: pipenv_lock
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
name: Publish python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: python -m pip install --upgrade build
- run: python -m build

Expand All @@ -33,4 +33,4 @@ jobs:
repo: plug
workflow_id: 12413223
token: ${{ secrets.CI_TOKEN_CLONE_REPO }}
inputs: '{"imageTags": "stable"}'
inputs: '{"imageTag": "stable"}'
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bokeh = "~=2.0"
matplotlib = "~=3.3"
numpy = "~=1.20"
pandas = "~=1.4.0"
powersimdata = "~=0.5.4"
powersimdata = "~=0.5.5"
pyproj = "~=3.0"

[dev-packages]
Expand Down
1,168 changes: 771 additions & 397 deletions Pipfile.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/Breakthrough-Energy/PostREISE/develop?logo=GitHub)
![GitHub pull requests](https://img.shields.io/github/issues-pr/Breakthrough-Energy/PostREISE?logo=GitHub)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat)](https://breakthrough-energy.github.io/docs/communication/code_of_conduct.html)
[![Code of Conduct](https://img.shields.io/badge/Code_of_conduct-ff69b4.svg)](https://breakthrough-energy.github.io/docs/communication/code_of_conduct.html)
[![Slack](https://img.shields.io/badge/Community_Slack-sign_up-1f425f.svg?logo=slack)](https://science.breakthroughenergy.org/#get-updates)


# PostREISE
Expand Down
50 changes: 28 additions & 22 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
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
### Requirements
This guide will demonstrate how to regenerate the plots used in the
[documentation][docs]. The only requirement is that docker is installed. The
scenarios used will be downloaded from blob storage, which may take a while but
should happen automatically.

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.
### Usage
First, go to this directory, then start the container, which will provide a
notebook environment for running the code snippets.
```
cd docs
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).
Access the notebook in your browser using the localhost url given by jupyter.
NOTE: if the host port is already in use by another container, it can be
changed to one that is available (e.g. 10001). In this case, you'll need to
change the port in the url to match, since the one given by jupyter is the port
inside the container.

Now simply run the notebook to regenerate the plots. 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.
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.
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
[docs]: https://breakthrough-energy.github.io/docs/postreise/index.html
4 changes: 2 additions & 2 deletions docs/analyze.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ Generator Capacity and Generation
data = os.path.join(os.path.dirname(inspect.getfile(postreise)), "data")
hist_gen = pd.read_csv(
os.path.join(data, "2016_Historical_USA_TAMU_Generation_GWh.csv"), index_col=0
hist_gen = pd.read_csv(
os.path.join(data, "2016_Historical_USA_TAMU_Generation_GWh.csv"), index_col=0
).T
historical_generation = summarize_hist_gen(hist_gen, hist_gen.columns.to_list())
Expand Down
2 changes: 1 addition & 1 deletion docs/code/curtailment_eastern.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
plot_curtailment_time_series(
scenario,
"Eastern",
["wind", "solar"],
["solar", "wind"],
time_freq="D",
t2c=t2c,
label_fontsize=30,
Expand Down
10 changes: 4 additions & 6 deletions docs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
version: '3.7'

services:
postreise:
container_name: postreise
hostname: postreise
container_name: postreise_docs
hostname: postreise_docs
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
- ~/ScenarioData:/mnt/bes/pcm
- ./:/app
ports:
- "10000:10000"
- 10000:10000
environment:
- DEPLOYMENT_MODE=1
5 changes: 4 additions & 1 deletion docs/helper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import base64

mpl_config = {
"single": {
"curtailment_eastern": (
Expand Down Expand Up @@ -41,4 +43,5 @@
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"])
content = output.data["image/png"].encode()
f.write(base64.decodebytes(content))
Loading

0 comments on commit 53d9c91

Please sign in to comment.