Skip to main content

PVNet

All Contributors

tags badge ease of contribution: hard

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:

  1. 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 supplies
      • image_size_pixels: spatial crop matching your NWP resolution and the settings in your datamodule configuration (unless you coarsened, e.g. for ECMWF)
  2. In configs/trainer/default.yaml:
    • Set accelerator: 0 if running on a system without a supported GPU
  3. In configs/datamodule/streamed_samples.yaml:
    • Point configuration: to your local example_configuration.yaml (or your custom one)
    • Adjust the train/val/test time ranges to your available data

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):

Felix
Felix

💻
Sukhil Patel
Sukhil Patel

💻
James Fulton
James Fulton

💻
Alexandra Udaltsova
Alexandra Udaltsova

💻 👀
Megawattz
Megawattz

💻
Peter Dudfield
Peter Dudfield

💻
Mahdi Lamb
Mahdi Lamb

🚇
Jacob Prince-Bieker
Jacob Prince-Bieker

💻
codderrrrr
codderrrrr

💻
Chris Briggs
Chris Briggs

💻
tmi
tmi

💻
Chris Arderne
Chris Arderne

💻
Dakshbir
Dakshbir

💻
MAYANK SHARMA
MAYANK SHARMA

💻
aryan lamba
aryan lamba

💻
michael-gendy
michael-gendy

💻
Aditya Suthar
Aditya Suthar

💻
Markus Kreft
Markus Kreft

💻
Jack Kelly
Jack Kelly

🤔
zaryab-ali
zaryab-ali

💻
Lex-Ashu
Lex-Ashu

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pvnet-5.3.24.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pvnet-5.3.24-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

File details

Details for the file pvnet-5.3.24.tar.gz.

File metadata

  • Download URL: pvnet-5.3.24.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pvnet-5.3.24.tar.gz
Algorithm Hash digest
SHA256 678997e4b5739af90d0feaedc85be461896d9f3495f5e8b7fb6f16771a305ff8
MD5 99fc0ec2a090a9a86a93538f4e69387a
BLAKE2b-256 3e4e8ed580b2369e181a433c61217680e7b7f685c19912c80daa4d2131cc9f9b

See more details on using hashes here.

File details

Details for the file pvnet-5.3.24-py3-none-any.whl.

File metadata

  • Download URL: pvnet-5.3.24-py3-none-any.whl
  • Upload date:
  • Size: 42.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pvnet-5.3.24-py3-none-any.whl
Algorithm Hash digest
SHA256 e0a7082ec91f824fb32fd167e1bc1d0d1d68983a1cb21cacfed4b76f82459db0
MD5 2191155587ebeaed76a8b55a868836d5
BLAKE2b-256 0430338dd43236524ba1b15fb363eb56c6c1e0661768c9655fa7261e68c82c58

See more details on using hashes here.

Release history Release notifications | RSS feed

5.3.25

2 files

This release

5.3.24 This release

2 files

5.3.23

2 files

5.3.22

2 files

5.3.21

2 files

5.3.20

2 files

5.3.19

2 files

5.3.18

2 files

5.3.17

2 files

5.3.16

2 files

5.3.15

2 files

5.3.14

2 files

5.3.13

2 files

5.3.12

2 files

5.3.11

2 files

5.3.10

2 files

5.3.9

2 files

5.3.8

2 files

5.3.7

2 files

5.3.6

2 files

5.3.5

2 files

5.3.4

2 files

5.3.3

2 files

5.3.2

2 files

5.3.1

2 files

5.3.0

2 files

5.2.3

2 files

5.2.2

2 files

5.2.1

2 files

5.2.0

2 files

5.1.3

2 files

5.1.2

2 files

5.1.1

2 files

5.1.0

2 files

5.0.26

2 files

5.0.24

2 files

5.0.23

2 files

5.0.22

2 files

5.0.21

2 files

5.0.20

2 files

5.0.19

2 files

5.0.18

2 files

5.0.17

2 files

5.0.16

2 files

5.0.15

2 files

5.0.14

2 files

5.0.13

2 files

5.0.12

2 files

5.0.11

2 files

5.0.10

2 files

5.0.9

2 files

5.0.8

2 files

5.0.7

2 files

5.0.5

2 files

5.0.4

2 files

5.0.3

2 files

5.0.2

2 files

5.0.1

2 files

5.0.0

2 files

4.1.30

2 files

4.1.29

2 files

4.1.28

2 files

4.1.27

2 files

4.1.26

2 files

4.1.25

2 files

4.1.24

2 files

4.1.23

2 files

4.1.22

2 files

4.1.21

2 files

4.1.20

2 files

4.1.19

2 files

4.1.18

2 files

4.1.17

2 files

4.1.16

2 files

4.1.15

2 files

4.1.14

2 files

4.1.13

2 files

4.1.12

2 files

4.1.11

2 files

4.1.10

2 files

4.1.9

2 files

4.1.8

2 files

4.1.7

2 files

4.1.6

2 files

4.1.5

2 files

4.1.4

2 files

4.1.3

2 files

4.1.2

2 files

4.1.1

2 files

4.1.0

2 files

4.0.11

2 files

4.0.10

2 files

4.0.9

2 files

4.0.8

2 files

4.0.7

2 files

4.0.6

2 files

4.0.5

2 files

4.0.4

2 files

4.0.3

2 files

4.0.2

2 files

4.0.1

2 files

4.0.0

2 files

3.0.64

2 files

3.0.63

2 files

3.0.62

2 files

3.0.61

2 files

3.0.60

2 files

3.0.59

2 files

3.0.58

2 files

3.0.57

2 files

3.0.56

2 files

3.0.55

2 files

3.0.54

2 files

3.0.53

2 files

3.0.52

2 files

3.0.51

2 files

3.0.50

2 files

3.0.49

2 files

3.0.48

2 files

3.0.47

2 files

3.0.46

2 files

3.0.45

2 files

3.0.44

2 files

3.0.43

2 files

3.0.42

2 files

3.0.41

2 files

3.0.40

2 files

3.0.39

2 files

3.0.38

2 files

3.0.37

2 files

3.0.36

2 files

3.0.35

2 files

3.0.30

2 files

3.0.29

2 files

3.0.28

2 files

3.0.27

2 files

3.0.26

2 files

3.0.25

2 files

3.0.24

2 files

3.0.23

2 files

3.0.22

2 files

3.0.21

2 files

3.0.20

2 files

3.0.19

2 files

3.0.18

2 files

3.0.17

2 files

3.0.16

2 files

3.0.15

2 files

3.0.14

2 files

3.0.13

2 files

3.0.12

2 files

3.0.11

2 files

3.0.10

2 files

3.0.9

2 files

3.0.8

2 files

3.0.7

2 files

3.0.6

2 files

3.0.5

2 files

3.0.4

2 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.6.11

2 files

2.6.10

2 files

2.6.9

2 files

2.6.8

2 files

2.6.7

2 files

2.6.6

2 files

2.6.5

2 files

2.6.4

2 files

2.6.3

2 files

2.6.2

2 files

2.6.1

2 files

2.6.0

2 files

2.5.1

2 files

2.5.0

2 files

2.4.4

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.1

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.29

2 files

2.1.28

2 files

2.1.27

2 files

2.1.26

2 files

2.1.25

2 files

2.1.24

2 files

2.1.23

2 files

2.1.22

2 files

2.1.21

2 files

2.1.20

2 files

2.1.19

2 files

2.1.18

2 files

2.1.17

2 files

2.1.16

2 files

2.1.15

2 files

2.1.14

2 files

2.1.13

2 files

2.1.12

2 files

2.1.11

2 files

2.1.10

2 files

2.1.9

2 files

2.1.8

2 files

2.1.7

2 files

2.1.6

2 files

2.1.5

2 files

2.1.4

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0

2 files

1.0.0

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.22

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page