generated from openclimatefix/ocf-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #20 from openclimatefix/update #minor
Update #minor
- Loading branch information
Showing
31 changed files
with
228 additions
and
194 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
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
exclude = .tox,.eggs,ci/templates,build,dist, __init__.py | ||
ignore = E741,F403,E265,W504,E226,W503,E501,E203 |
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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
name: Bump version and auto-release | ||
name: Python Bump Version & release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "configs.example/**" # ignores all files in configs.example | ||
- "**/README.md" # ignores all README files | ||
|
||
jobs: | ||
release: | ||
uses: openclimatefix/.github/.github/workflows/python-release.yml@v1.7.2 | ||
uses: openclimatefix/.github/.github/workflows/python-release.yml@main | ||
secrets: | ||
token: ${{ secrets.PYPI_API_TOKEN }} | ||
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} |
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
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
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,2 @@ | ||
[settings] | ||
profile=black |
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
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 @@ | ||
configs.example |
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 |
---|---|---|
@@ -1,10 +1,90 @@ | ||
# PVNet summation | ||
This project is used for training a model to sum the GSP predictions of [PVNet](https://github.com/openclimatefix/PVNet) into a national estimate. | ||
|
||
## Setup | ||
Using this model to sum the GSP predictions rather than doing a simple sum increases the accuracy of the national predictions and can be configured to produce estimates of the uncertainty range of the national estimate. See the [PVNet](https://github.com/openclimatefix/PVNet) repo for more details and our paper. | ||
|
||
|
||
## Setup / Installation | ||
|
||
```bash | ||
git clone https://github.com/openclimatefix/PVNet_summation | ||
cd PVNet_summation | ||
pip install -r requirements.txt | ||
pip install git+https://github.com/SheffieldSolar/PV_Live-API | ||
pip install . | ||
``` | ||
|
||
### Additional development dependencies | ||
|
||
```bash | ||
pip install ".[dev]" | ||
``` | ||
|
||
## Getting started with running PVNet summation | ||
|
||
In order to run PVNet summation, we assume that you are already set up with | ||
[PVNet](https://github.com/openclimatefix/PVNet) and have met all the requirements there. | ||
|
||
Before running any code, copy the example configuration to a | ||
configs directory: | ||
|
||
``` | ||
cp -r configs.example configs | ||
``` | ||
|
||
You will be making local amendments to these configs. | ||
|
||
### Datasets | ||
|
||
The datasets required are the same as documented in | ||
[PVNet](https://github.com/openclimatefix/PVNet). The only addition is that you will need PVLive | ||
data for the national sum i.e. GSP ID 0. | ||
|
||
|
||
## Generating pre-made concurrent batches of data for PVNet | ||
|
||
It is required that you preprepare batches using the `save_concurrent_batches.py` script from | ||
PVNet. This saves the batches as required by the PVNet model to make predictions for all GSPs for | ||
a single forecast init time. Seen the PVNet package for more details on this. | ||
|
||
|
||
### Set up and config example for batch creation | ||
|
||
|
||
The concurrent batches created in the step above will be augmented with a few additional pieces of | ||
data required for the summation model. Within your copy of `PVNet_summation/configs` make sure you | ||
have replaced all of the items marked with `PLACEHOLDER` | ||
|
||
### Training PVNet_summation | ||
|
||
How PVNet_summation is run is determined by the extensive configuration in the config files. The | ||
configs stored in `PVNet/configs.example` should work with batches created using the steps and | ||
batch creation config mentioned above. | ||
|
||
Make sure to update the following config files before training your model: | ||
|
||
1. In `configs/datamodule/default.yaml`: | ||
- update `batch_dir` to point to the directory you stored your concurrent batches in during | ||
batch creation. | ||
- update `gsp_zarr_path` to point to the PVLive data containing the national estimate | ||
2. In `configs/model/default.yaml`: | ||
- update the PVNet model for which you are training a summation model for. A new summation model | ||
should be trained for each PVNet model | ||
- update the hyperparameters and structure of the summation model | ||
3. In `configs/trainer/default.yaml`: | ||
- set `accelerator: 0` if running on a system without a supported GPU | ||
4. In `configs.config.yaml`: | ||
- It is recommended that you set `presave_pvnet_outputs` to `True`. This means that the | ||
concurrent batches that you create will only be run through the PVNet model once before | ||
training and their outputs saved, rather than being run on the fly on each batch throughout | ||
training. This can speed up training significantly. | ||
|
||
|
||
Assuming you have updated the configs, you should now be able to run: | ||
|
||
``` | ||
python run.py | ||
``` | ||
|
||
|
||
## Testing | ||
|
||
You can use `python -m pytest tests` to run tests |
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
File renamed without changes.
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,6 @@ | ||
_target_: pvnet_summation.data.datamodule.DataModule | ||
batch_dir: "PLACEHOLDER" | ||
gsp_zarr_path: "PLACEHOLDER" | ||
batch_size: 32 | ||
num_workers: 20 | ||
prefetch_factor: 2 |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
"""PVNet_summation""" | ||
__version__ = "0.1.4" |
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
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
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
Oops, something went wrong.