PVNet
A multi-modal late-fusion model for predicting renewable energy generation from weather data.
https://github.com/openclimatefix/pvnet
Category: Renewable Energy
Sub Category: Photovoltaics and Solar Energy
Keywords from Contributors
nowcasting eumetsat dbml pvsite pvoutput solar gan forecasting-models graph-neural-networks weather
Last synced: about 20 hours ago
JSON representation
Repository metadata
PVnet main repo
- Host: GitHub
- URL: https://github.com/openclimatefix/pvnet
- Owner: openclimatefix
- License: mit
- Created: 2022-11-14T10:55:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-05-19T14:56:45.000Z (22 days ago)
- Last Synced: 2026-05-22T20:14:16.369Z (19 days ago)
- Language: Python
- Homepage:
- Size: 333 MB
- Stars: 53
- Watchers: 3
- Forks: 49
- Open Issues: 11
- Releases: 191
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
PVNet
This project is used for training PVNet and running PVNet on live data.
PVNet is a multi-modal late-fusion model for predicting renewable energy generation from weather
data. The NWP (Numerical Weather Prediction) and satellite data are sent through a neural network
which encodes them down to 1D intermediate representations. These are concatenated together with
recent generation, the calculated solar coordinates (azimuth and elevation) and the location ID
which has been put through an embedding layer. This 1D concatenated feature vector is put through
an output network which outputs predictions of the future energy yield.
Experiments
Our paper based on this repo was accepted into the Tackling Climate Change with Machine Learning
workshop at ICLR 2024 and can be viewed here.
Some more structured notes on experiments we have performed with PVNet are
here.
Setup / Installation
git clone git@github.com:openclimatefix/PVNet.git
cd PVNet
pip install .
The commit history is extensive. To save download time, use a depth of 1:
git clone --depth 1 git@github.com:openclimatefix/PVNet.git
This means only the latest commit and its associated files will be downloaded.
Next, in the PVNet repo, install PVNet as an editable package:
pip install -e .
Additional development dependencies
pip install ".[dev]"
Getting started with running PVNet
Before running any code in PVNet, copy the example configuration to a
configs directory:
cp -r configs.example configs
You will be making local amendments to these configs. See the README in
configs.example for more info.
Datasets
As a minimum, in order to create samples of data/run PVNet, you will need to
supply paths to NWP and GSP data. PV data can also be used. We list some
suggested locations for downloading such datasets below:
GSP (Grid Supply Point) - Regional PV generation data
The University of Sheffield provides API access to download this data:
https://www.solar.sheffield.ac.uk/api/
Documentation for querying generation data aggregated by GSP region can be found
here:
https://docs.google.com/document/d/e/2PACX-1vSDFb-6dJ2kIFZnsl-pBQvcH4inNQCA4lYL9cwo80bEHQeTK8fONLOgDf6Wm4ze_fxonqK3EVBVoAIz/pub#h.9d97iox3wzmd
NWP (Numerical weather predictions)
OCF maintains a Zarr formatted version of the German Weather Service's (DWD)
ICON-EU NWP model here:
https://huggingface.co/datasets/openclimatefix/dwd-icon-eu which includes the UK
PV
OCF maintains a dataset of PV generation from 1311 private PV installations
here: https://huggingface.co/datasets/openclimatefix/uk_pv
Connecting with ocf-data-sampler for sample creation
Outside the PVNet repo, clone the ocf-data-sampler repo and exit the conda env created for PVNet: https://github.com/openclimatefix/ocf-data-sampler
git clone git@github.com/openclimatefix/ocf-data-sampler.git
conda create -n ocf-data-sampler python=3.11
Then go inside the ocf-data-sampler repo to add packages
pip install .
Then exit this environment, and enter back into the pvnet conda environment and install ocf-data-sampler in editable mode (-e). This means the package is directly linked to the source code in the ocf-data-sampler repo.
pip install -e <PATH-TO-ocf-data-sampler-REPO>
If you install the local version of ocf-data-sampler that is more recent than the version
specified in PVNet it is not guarenteed to function properly with this library.
Set up and config example for streaming
We will use the following example config file to describe your data sources: /PVNet/configs/datamodule/configuration/example_configuration.yaml. Ensure that the file paths are set to the correct locations in example_configuration.yaml: search for PLACEHOLDER to find where to input the location of the files. Delete or comment the parts for data you are not using.
At run time, the datamodule config PVNet/configs/datamodule/streamed_samples.yaml points to your chosen configuration file:
configuration: "/FULL-PATH-TO-REPO/PVNet/configs/datamodule/configuration/example_configuration.yaml"
You can also update train/val/test time ranges here to match the period you have access to.
If downloading private data from a GCP bucket make sure to authenticate gcloud (the public satellite data does not need authentication):
gcloud auth login
You can provide multiple storage locations as a list. For example:
satellite:
zarr_path:
- "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr"
- "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2021_nonhrv.zarr"
ocf-data-sampler is currently set up to use 11 channels from the satellite data (the 12th, HRV, is not used).
⚠️ NB: Our publicly accessible satellite data is currently saved with a blosc2 compressor, which is not supported by the tensorstore backend PVNet relies on now. We are in the process of updating this; for now, the paths above cannot be used with this codebase.
Training PVNet
How PVNet is run is determined by the configuration files. The example configs in PVNet/configs.example work with streamed_samples using datamodule/streamed_samples.yaml.
Update the following before training:
- In
configs/model/late_fusion.yaml:- Update the list of encoders to match the data sources you are using. For different NWP sources, keep the same structure but ensure:
in_channels: the number of variables your NWP source suppliesimage_size_pixels: spatial crop matching your NWP resolution and the settings in your datamodule configuration (unless you coarsened, e.g. for ECMWF)
- Update the list of encoders to match the data sources you are using. For different NWP sources, keep the same structure but ensure:
- In
configs/trainer/default.yaml:- Set
accelerator: 0if running on a system without a supported GPU
- Set
- In
configs/datamodule/streamed_samples.yaml:- Point
configuration:to your localexample_configuration.yaml(or your custom one) - Adjust the train/val/test time ranges to your available data
- Point
If you create custom config files, update the main ./configs/config.yaml defaults:
defaults:
- trainer: default.yaml
- model: late_fusion.yaml
- datamodule: streamed_samples.yaml
- callbacks: null
- experiment: null
- hparams_search: null
- hydra: default.yaml
Now train PVNet:
python run.py
You can override any setting with Hydra, e.g.:
python run.py datamodule=streamed_samples datamodule.configuration="/FULL-PATH/PVNet/configs/datamodule/configuration/example_configuration.yaml"
Backtest
If you have successfully trained a PVNet model and have a saved model checkpoint you can create a backtest using this, e.g. forecasts on historical data to evaluate forecast accuracy/skill. This can be done by running one of the scripts in this repo such as the UK GSP backtest script or the the pv site backtest script, further info on how to run these are in each backtest file.
Testing
You can use python -m pytest tests to run tests
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Owner metadata
- Name: Open Climate Fix
- Login: openclimatefix
- Email: info@openclimatefix.org
- Kind: organization
- Description: Using open science to mitigate climate change
- Website: openclimatefix.org
- Location: London
- Twitter: openclimatefix
- Company:
- Icon url: https://avatars.githubusercontent.com/u/48357542?v=4
- Repositories: 88
- Last ynced at: 2024-04-15T07:32:15.529Z
- Profile URL: https://github.com/openclimatefix
GitHub Events
Total
- Delete event: 30
- Pull request event: 56
- Fork event: 4
- Issues event: 34
- Watch event: 6
- Issue comment event: 25
- Push event: 95
- Pull request review comment event: 69
- Pull request review event: 61
- Create event: 37
Last Year
- Delete event: 30
- Pull request event: 56
- Fork event: 4
- Issues event: 34
- Watch event: 6
- Issue comment event: 25
- Push event: 95
- Pull request review comment event: 69
- Pull request review event: 61
- Create event: 37
Committers metadata
Last synced: 12 days ago
Total Commits: 1,411
Total Committers: 27
Avg Commits per committer: 52.259
Development Distribution Score (DDS): 0.792
Commits in past year: 100
Committers in past year: 12
Avg Commits per committer in past year: 8.333
Development Distribution Score (DDS) in past year: 0.64
| Name | Commits | |
|---|---|---|
| peterdudfield | p****d@h****m | 294 |
| James Fulton | d****n@y****k | 283 |
| BumpVersion Action | b****n@g****s | 195 |
| Jacob Bieker | j****b@b****h | 193 |
| pre-commit-ci[bot] | 6****] | 167 |
| Jack Kelly | j****k@O****g | 113 |
| Sukhil Patel | 4****P | 33 |
| Alexandra Udaltsova | 4****a | 30 |
| allcontributors[bot] | 4****] | 23 |
| Chris Arderne | c****s@r****e | 19 |
| Felix | 1****p | 18 |
| Sukhil Patel | s****l@S****l | 11 |
| megawattz | z****s@g****m | 10 |
| Peter Dudfield | 6 | |
| Chris Briggs | c****x@g****m | 2 |
| Lex-Ashu | t****y@g****m | 2 |
| zaryab-ali | 8****i | 2 |
| Aditya Suthar | 9****r | 1 |
| Ali Rashid | 1****R | 1 |
| Dakshbir | 1****r | 1 |
| Mahdi Lamb | m****b@g****m | 1 |
| Markus Kreft | 1****t | 1 |
| aryan lamba | 1****1 | 1 |
| coderrrrr | s****1@g****m | 1 |
| devsjc | 4****c | 1 |
| michael-gendy | 6****y | 1 |
| tmi | v****a@g****m | 1 |
Committer domains:
- rdrn.me: 1
- openclimatefix.org: 1
- bieker.tech: 1
- yahoo.co.uk: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 161
Total pull requests: 413
Average time to close issues: 2 months
Average time to close pull requests: 7 days
Total issue authors: 17
Total pull request authors: 29
Average comments per issue: 1.73
Average comments per pull request: 0.9
Merged pull request: 332
Bot issues: 0
Bot pull requests: 41
Past year issues: 29
Past year pull requests: 73
Past year average time to close issues: 22 days
Past year average time to close pull requests: 1 day
Past year issue authors: 7
Past year pull request authors: 11
Past year average comments per issue: 1.1
Past year average comments per pull request: 0.44
Past year merged pull request: 51
Past year bot issues: 0
Past year bot pull requests: 9
Top Issue Authors
- peterdudfield (73)
- AUdaltsova (22)
- dfulu (15)
- Sukh-P (14)
- jacobbieker (8)
- felix-e-h-p (6)
- zakwatts (5)
- tomasvanoyen (5)
- zaryab-ali (4)
- AndranikUgujyan (2)
- confusedmatrix (1)
- carderne (1)
- ryanbradshawcodes (1)
- gabrielelibardi (1)
- AoufNihed (1)
Top Pull Request Authors
- dfulu (127)
- Sukh-P (59)
- peterdudfield (51)
- AUdaltsova (34)
- allcontributors[bot] (26)
- jacobbieker (23)
- felix-e-h-p (21)
- pre-commit-ci[bot] (15)
- zakwatts (11)
- Param1304 (6)
- markus-kreft (4)
- chaitanya-rdY (4)
- zaryab-ali (3)
- devojyotimisra (3)
- lambaaryan011 (2)
Top Issue Labels
- bug (30)
- enhancement (26)
- timeline (12)
- good first issue (8)
- discussion (7)
- contributions-welcome (4)
- ocf-internal (2)
- duplicate (1)
- documentation (1)
Top Pull Request Labels
- enhancement (13)
- bug (3)
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 2,781 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 236
- Total maintainers: 1
pypi.org: pvnet
PVNet
- Homepage:
- Documentation: https://pvnet.readthedocs.io/
- Licenses: mit
- Latest release: 5.3.14 (published about 1 month ago)
- Last Synced: 2026-04-30T06:04:49.656Z (about 1 month ago)
- Versions: 236
- Dependent Packages: 1
- Dependent Repositories: 1
- Downloads: 2,781 Last month
-
Rankings:
- Dependent packages count: 4.798%
- Downloads: 7.782%
- Average: 11.368%
- Dependent repos count: 21.526%
- Maintainers (1)
Dependencies
- black * development
- flake8 * development
- isort * development
- mypy * development
- pre-commit * development
- pytest * development
- pytest-cov * development
- black *
- flake8 *
- h5netcdf *
- hydra-core *
- hydra-optuna-sweeper *
- ipykernel *
- jedi *
- matplotlib *
- neptune-client *
- nowcasting_utils *
- numpy *
- ocf_datapipes *
- omegaconf *
- pandas *
- perceiver_pytorch *
- pytest *
- pytest-cov *
- python-dotenv *
- pytorch-lightning *
- rich *
- tables *
- tilemapbase *
- torch *
- xarray *
Score: 15.386363970818312