PVNet 2.6.9__tar.gz → 2.6.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PVNet-2.6.9 → PVNet-2.6.11}/PKG-INFO +99 -97
- {PVNet-2.6.9 → PVNet-2.6.11}/PVNet.egg-info/PKG-INFO +99 -97
- {PVNet-2.6.9 → PVNet-2.6.11}/PVNet.egg-info/SOURCES.txt +2 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/PVNet.egg-info/requires.txt +1 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/README.md +97 -96
- PVNet-2.6.11/pvnet/__init__.py +2 -0
- PVNet-2.6.9/pvnet/data/datamodule.py → PVNet-2.6.11/pvnet/data/base.py +1 -1
- PVNet-2.6.11/pvnet/data/datamodule.py +92 -0
- PVNet-2.6.11/pvnet/data/pv_site_datamodule.py +98 -0
- PVNet-2.6.11/pvnet/data/wind_datamodule.py +99 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/base_model.py +93 -22
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/baseline/last_value.py +2 -2
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/baseline/single_value.py +1 -1
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/deep_supervision.py +7 -7
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/encoders/encoders3d.py +24 -7
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/multimodal.py +115 -17
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/nwp_weighting.py +1 -1
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/site_encoders/encoders.py +48 -34
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/weather_residual.py +8 -8
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/utils.py +13 -5
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/utils.py +25 -8
- {PVNet-2.6.9 → PVNet-2.6.11}/requirements.txt +2 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/tests/conftest.py +1 -1
- PVNet-2.6.9/pvnet/__init__.py +0 -2
- PVNet-2.6.9/pvnet/data/wind_datamodule.py +0 -141
- {PVNet-2.6.9 → PVNet-2.6.11}/LICENSE +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/MANIFEST.in +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/PVNet.egg-info/dependency_links.txt +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/PVNet.egg-info/top_level.txt +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/callbacks.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/data/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/data/utils.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/baseline/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/basic_blocks.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/encoders/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/optimizers.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pvnet/training.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/pyproject.toml +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/requirements-dev.txt +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/setup.cfg +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/setup.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/tests/__init__.py +0 -0
- {PVNet-2.6.9 → PVNet-2.6.11}/tests/test_end2end.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.11
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author: Peter Dudfield
|
|
6
6
|
Author-email: info@openclimatefix.org
|
|
@@ -32,6 +32,7 @@ Requires-Dist: hydra-core
|
|
|
32
32
|
Requires-Dist: python-dotenv
|
|
33
33
|
Requires-Dist: hydra-optuna-sweeper
|
|
34
34
|
Requires-Dist: rich
|
|
35
|
+
Requires-Dist: gcsfs
|
|
35
36
|
Provides-Extra: all-models
|
|
36
37
|
Requires-Dist: pytorch-tabnet; extra == "all-models"
|
|
37
38
|
Requires-Dist: efficientnet_pytorch; extra == "all-models"
|
|
@@ -66,12 +67,26 @@ cd PVNet
|
|
|
66
67
|
pip install -r requirements.txt
|
|
67
68
|
```
|
|
68
69
|
|
|
70
|
+
The commit history is extensive. To save download time, use a depth of 1:
|
|
71
|
+
```bash
|
|
72
|
+
git clone --depth 1 https://github.com/openclimatefix/PVNet.git
|
|
73
|
+
```
|
|
74
|
+
This means only the latest commit and its associated files will be downloaded.
|
|
75
|
+
|
|
76
|
+
Next, in the PVNet repo, install PVNet as an editable package:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install -e .
|
|
80
|
+
```
|
|
81
|
+
|
|
69
82
|
### Additional development dependencies
|
|
70
83
|
|
|
71
84
|
```bash
|
|
72
85
|
pip install -r requirements-dev.txt
|
|
73
86
|
```
|
|
74
87
|
|
|
88
|
+
|
|
89
|
+
|
|
75
90
|
## Getting started with running PVNet
|
|
76
91
|
|
|
77
92
|
Before running any code in within PVNet, copy the example configuration to a
|
|
@@ -107,116 +122,103 @@ https://huggingface.co/datasets/openclimatefix/dwd-icon-eu which includes the UK
|
|
|
107
122
|
OCF maintains a dataset of PV generation from 1311 private PV installations
|
|
108
123
|
here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
109
124
|
|
|
110
|
-
### Generating pre-made batches of data for training/validation of PVNet
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
PVNet models.
|
|
126
|
+
### Connecting with ocf_datapipes for batch creation
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
Outside the PVNet repo, clone the ocf-datapipes repo and exit the conda env created for PVNet: https://github.com/openclimatefix/ocf_datapipes
|
|
129
|
+
```bash
|
|
130
|
+
git clone --depth 1 https://github.com/openclimatefix/ocf_datapipes.git
|
|
131
|
+
conda create -n ocf_datapipes python=3.10
|
|
132
|
+
```
|
|
117
133
|
|
|
118
|
-
|
|
119
|
-
`./configs/datamodule/configiration/local_configuration.yaml` and paste the
|
|
120
|
-
sample config (shown below)
|
|
121
|
-
2. Duplicate the `./configs/datamodule/ocf_datapipes.yaml` to
|
|
122
|
-
`./configs/datamodule/_local_ocf_datapipes.yaml` and ensure the
|
|
123
|
-
`configuration` key points to your newly created configuration file in
|
|
124
|
-
step 1.
|
|
125
|
-
3. Also in this file, update the train, val & test periods to cover the data you
|
|
126
|
-
have access to.
|
|
127
|
-
4. To get you started with your own configuration file, see the sample config
|
|
128
|
-
below. Update the data paths to the location of your local GSP, NWP and PV
|
|
129
|
-
datasets:
|
|
134
|
+
Then go inside the ocf_datapipes repo to add packages
|
|
130
135
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
description: Demo config
|
|
134
|
-
name: demo_datamodule_config
|
|
135
|
-
|
|
136
|
-
input_data:
|
|
137
|
-
default_history_minutes: 60
|
|
138
|
-
default_forecast_minutes: 120
|
|
139
|
-
|
|
140
|
-
gsp:
|
|
141
|
-
gsp_zarr_path: /path/to/gsp-data.zarr
|
|
142
|
-
history_minutes: 60
|
|
143
|
-
forecast_minutes: 120
|
|
144
|
-
time_resolution_minutes: 30
|
|
145
|
-
start_datetime: "2019-01-01T00:00:00"
|
|
146
|
-
end_datetime: "2019-01-08T00:00:00"
|
|
147
|
-
metadata_only: false
|
|
148
|
-
|
|
149
|
-
nwp:
|
|
150
|
-
ukv:
|
|
151
|
-
nwp_zarr_path: /path/to/nwp-data.zarr
|
|
152
|
-
history_minutes: 60
|
|
153
|
-
forecast_minutes: 120
|
|
154
|
-
time_resolution_minutes: 60
|
|
155
|
-
nwp_channels: # comment out channels as appropriate
|
|
156
|
-
- t # 2-metre temperature
|
|
157
|
-
- dswrf # downwards short-wave radiation flux
|
|
158
|
-
- dlwrf # downwards long-wave radiation flux
|
|
159
|
-
- hcc # high cloud cover
|
|
160
|
-
- mcc # medium cloud cover
|
|
161
|
-
- lcc # low cloud cover
|
|
162
|
-
- vis # visability
|
|
163
|
-
- r # relative humidity
|
|
164
|
-
- prate # precipitation rate
|
|
165
|
-
- si10 # 10-metre wind speed | live = unknown
|
|
166
|
-
nwp_image_size_pixels_height: 24
|
|
167
|
-
nwp_image_size_pixels_width: 24
|
|
168
|
-
nwp_provider: ukv
|
|
169
|
-
|
|
170
|
-
pv:
|
|
171
|
-
pv_files_groups:
|
|
172
|
-
- label: pvoutput.org
|
|
173
|
-
pv_filename: /path/to/pv-data/pv.netcdf
|
|
174
|
-
pv_metadata_filename: /path/to/pv-data/metadata.csv
|
|
175
|
-
history_minutes: 60
|
|
176
|
-
forecast_minutes: 0 # PVNet assumes no future PV generation
|
|
177
|
-
time_resolution_minutes: 5
|
|
178
|
-
start_datetime: "2019-01-01T00:00:00"
|
|
179
|
-
end_datetime: "2019-01-08T00:00:00"
|
|
180
|
-
pv_image_size_meters_height: 24
|
|
181
|
-
pv_image_size_meters_width: 24
|
|
182
|
-
pv_ml_ids: [154,155,156,158,159,160,162,164,165,166,167,168,169,171,173,177,178,179,181,182,185,186,187,188,189,190,191,192,193,197,198,199,200,202,204,205,206,208,209,211,214,215,216,217,218,219,220,221,225,229,230,232,233,234,236,242,243,245,252,254,255,256,257,258,260,261,262,265,267,268,272,273,275,276,277,280,281,282,283,287,289,291,292,293,294,295,296,297,298,301,302,303,304,306,307,309,310,311,317,318,319,320,321,322,323,325,326,329,332,333,335,336,338,340,342,344,345,346,348,349,352,354,355,356,357,360,362,363,368,369,370,371,372,374,375,376,378,380,382,384,385,388,390,391,393,396,397,398,399,400,401,403,404,405,406,407,409,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,429,431,435,437,438,440,441,444,447,450,451,453,456,457,458,459,464,465,466,467,468,470,471,473,474,476,477,479,480,481,482,485,486,488,490,491,492,493,496,498,501,503,506,507,508,509,510,511,512,513,515,516,517,519,520,521,522,524,526,527,528,531,532,536,537,538,540,541,542,543,544,545,549,550,551,552,553,554,556,557,560,561,563,566,568,571,572,575,576,577,579,580,581,582,584,585,588,590,594,595,597,600,602,603,604,606,611,613,614,616,618,620,622,623,624,625,626,628,629,630,631,636,637,638,640,641,642,644,645,646,650,651,652,653,654,655,657,660,661,662,663,666,667,668,670,675,676,679,681,683,684,685,687,696,698,701,702,703,704,706,710,722,723,724,725,727,728,729,730,732,733,734,735,736,737,]
|
|
183
|
-
n_pv_systems_per_example: 128
|
|
184
|
-
get_center: false
|
|
185
|
-
is_live: false
|
|
186
|
-
|
|
187
|
-
satellite:
|
|
188
|
-
satellite_zarr_path: "" # Left empty to avoid using satellite data
|
|
189
|
-
history_minutes: 60
|
|
190
|
-
forecast_minutes: 0
|
|
191
|
-
live_delay_minutes: 30
|
|
192
|
-
time_resolution_minutes: 5
|
|
193
|
-
satellite_channels:
|
|
194
|
-
- IR_016
|
|
195
|
-
- IR_039
|
|
196
|
-
- IR_087
|
|
197
|
-
- IR_097
|
|
198
|
-
- IR_108
|
|
199
|
-
- IR_120
|
|
200
|
-
- IR_134
|
|
201
|
-
- VIS006
|
|
202
|
-
- VIS008
|
|
203
|
-
- WV_062
|
|
204
|
-
- WV_073
|
|
205
|
-
satellite_image_size_pixels_height: 24
|
|
206
|
-
satellite_image_size_pixels_width: 24
|
|
136
|
+
```bash
|
|
137
|
+
pip install -r requirements.txt requirements-dev.txt
|
|
207
138
|
```
|
|
208
139
|
|
|
140
|
+
Then exit this environment, and enter back into the pvnet conda environment and install ocf_datapies in editable mode (-e). This means the package is directly linked to the source code in the ocf_datapies repo.
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pip install -e <PATH-TO-ocf_datapipes-REPO>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Generating pre-made batches of data for training/validation of PVNet
|
|
147
|
+
|
|
148
|
+
PVNet contains a script for generating batches of data suitable for training the PVNet models. To run the script you will need to make some modifications to the datamodule configuration.
|
|
149
|
+
|
|
150
|
+
Make sure you have copied the example configs (as already stated above):
|
|
151
|
+
```
|
|
152
|
+
cp -r configs.example configs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Set up and config example for batch creation
|
|
156
|
+
|
|
157
|
+
We will use the example of creating batches using data from gcp:
|
|
158
|
+
`/PVNet/configs/datamodule/configuration/gcp_configuration.yaml`
|
|
159
|
+
Ensure that the file paths are set to the correct locations in
|
|
160
|
+
`gcp_configuration.yaml`.
|
|
161
|
+
|
|
162
|
+
`PLACEHOLDER` is used to indcate where to input the location of the files.
|
|
163
|
+
|
|
164
|
+
For OCF use cases, file locations can be found in `template_configuration.yaml` located alongside `gcp_configuration.yaml`.
|
|
165
|
+
|
|
166
|
+
In these configurations you can update the train, val & test periods to cover the data you have access to.
|
|
167
|
+
|
|
168
|
+
|
|
209
169
|
With your configuration in place, you can proceed to create batches. PVNet uses
|
|
210
170
|
[hydra](https://hydra.cc/) which enables us to pass variables via the command
|
|
211
171
|
line that will override the configuration defined in the `./configs` directory.
|
|
212
172
|
|
|
213
|
-
|
|
214
|
-
|
|
173
|
+
When creating batches, an additional config is used which is passed into the batch creation script. This is the datamodule config located `PVNet/configs/datamodule`.
|
|
174
|
+
|
|
175
|
+
For this example we will be using the `streamed_batches.yaml` config. Like before, a placeholder variable is used when specifing which configuration to use:
|
|
176
|
+
|
|
177
|
+
`configuration: "PLACEHOLDER.yaml"`
|
|
178
|
+
|
|
179
|
+
This should be given the whole path to the config on your local machine, such as for our example it should be changed to:
|
|
180
|
+
|
|
181
|
+
`configuration: "/FULL-PATH-TO-REPO/PVNet/configs/datamodule/configuration/gcp_configuration.yaml"
|
|
182
|
+
`
|
|
183
|
+
|
|
184
|
+
Where `FULL-PATH-TO-REPO` represent the whole path to the PVNet repo on your local machine.
|
|
185
|
+
|
|
186
|
+
### Running the batch creation script
|
|
187
|
+
|
|
188
|
+
Run the save_batches.py script to create batches with the following example arguments as:
|
|
215
189
|
|
|
216
190
|
```
|
|
217
|
-
python scripts/save_batches.py datamodule=
|
|
191
|
+
python scripts/save_batches.py datamodule=streamed_batches +batch_output_dir="./output" +num_train_batches=10 +num_val_batches=5
|
|
218
192
|
```
|
|
219
193
|
|
|
194
|
+
In this function the datamodule argument looks for a config under `PVNet/configs/datamodule`. The examples here are either to use "premade_batches" or "streamed_batches".
|
|
195
|
+
|
|
196
|
+
Its important that the dates set for the training, validation and testing in the datamodule (`streamed_batches.yaml`) config are within the ranges of the dates set for the input features in the configuration (`gcp_configuration.yaml`).
|
|
197
|
+
|
|
198
|
+
If downloading private data from a gcp bucket make sure to authenticate gcloud (the public satellite data does not need authentication):
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
gcloud auth login
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
For files stored in multiple locations they can be added as list. For example from the gcp_configuration.yaml file we can change from satellite data stored on a bucket:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
satellite:
|
|
208
|
+
satellite_zarr_path: gs://solar-pv-nowcasting-data/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
To satellite data hosted by Google:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
satellite:
|
|
215
|
+
satellite_zarr_paths:
|
|
216
|
+
- "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr"
|
|
217
|
+
- "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2021_nonhrv.zarr"
|
|
218
|
+
```
|
|
219
|
+
Datapipes is currently set up to use 11 channels from the satellite data, the 12th of which is HRV and is not included in these.
|
|
220
|
+
|
|
221
|
+
|
|
220
222
|
### Training PVNet
|
|
221
223
|
|
|
222
224
|
How PVNet is run is determined by the extensive configuration in the config
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.11
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author: Peter Dudfield
|
|
6
6
|
Author-email: info@openclimatefix.org
|
|
@@ -32,6 +32,7 @@ Requires-Dist: hydra-core
|
|
|
32
32
|
Requires-Dist: python-dotenv
|
|
33
33
|
Requires-Dist: hydra-optuna-sweeper
|
|
34
34
|
Requires-Dist: rich
|
|
35
|
+
Requires-Dist: gcsfs
|
|
35
36
|
Provides-Extra: all-models
|
|
36
37
|
Requires-Dist: pytorch-tabnet; extra == "all-models"
|
|
37
38
|
Requires-Dist: efficientnet_pytorch; extra == "all-models"
|
|
@@ -66,12 +67,26 @@ cd PVNet
|
|
|
66
67
|
pip install -r requirements.txt
|
|
67
68
|
```
|
|
68
69
|
|
|
70
|
+
The commit history is extensive. To save download time, use a depth of 1:
|
|
71
|
+
```bash
|
|
72
|
+
git clone --depth 1 https://github.com/openclimatefix/PVNet.git
|
|
73
|
+
```
|
|
74
|
+
This means only the latest commit and its associated files will be downloaded.
|
|
75
|
+
|
|
76
|
+
Next, in the PVNet repo, install PVNet as an editable package:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install -e .
|
|
80
|
+
```
|
|
81
|
+
|
|
69
82
|
### Additional development dependencies
|
|
70
83
|
|
|
71
84
|
```bash
|
|
72
85
|
pip install -r requirements-dev.txt
|
|
73
86
|
```
|
|
74
87
|
|
|
88
|
+
|
|
89
|
+
|
|
75
90
|
## Getting started with running PVNet
|
|
76
91
|
|
|
77
92
|
Before running any code in within PVNet, copy the example configuration to a
|
|
@@ -107,116 +122,103 @@ https://huggingface.co/datasets/openclimatefix/dwd-icon-eu which includes the UK
|
|
|
107
122
|
OCF maintains a dataset of PV generation from 1311 private PV installations
|
|
108
123
|
here: https://huggingface.co/datasets/openclimatefix/uk_pv
|
|
109
124
|
|
|
110
|
-
### Generating pre-made batches of data for training/validation of PVNet
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
PVNet models.
|
|
126
|
+
### Connecting with ocf_datapipes for batch creation
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
Outside the PVNet repo, clone the ocf-datapipes repo and exit the conda env created for PVNet: https://github.com/openclimatefix/ocf_datapipes
|
|
129
|
+
```bash
|
|
130
|
+
git clone --depth 1 https://github.com/openclimatefix/ocf_datapipes.git
|
|
131
|
+
conda create -n ocf_datapipes python=3.10
|
|
132
|
+
```
|
|
117
133
|
|
|
118
|
-
|
|
119
|
-
`./configs/datamodule/configiration/local_configuration.yaml` and paste the
|
|
120
|
-
sample config (shown below)
|
|
121
|
-
2. Duplicate the `./configs/datamodule/ocf_datapipes.yaml` to
|
|
122
|
-
`./configs/datamodule/_local_ocf_datapipes.yaml` and ensure the
|
|
123
|
-
`configuration` key points to your newly created configuration file in
|
|
124
|
-
step 1.
|
|
125
|
-
3. Also in this file, update the train, val & test periods to cover the data you
|
|
126
|
-
have access to.
|
|
127
|
-
4. To get you started with your own configuration file, see the sample config
|
|
128
|
-
below. Update the data paths to the location of your local GSP, NWP and PV
|
|
129
|
-
datasets:
|
|
134
|
+
Then go inside the ocf_datapipes repo to add packages
|
|
130
135
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
description: Demo config
|
|
134
|
-
name: demo_datamodule_config
|
|
135
|
-
|
|
136
|
-
input_data:
|
|
137
|
-
default_history_minutes: 60
|
|
138
|
-
default_forecast_minutes: 120
|
|
139
|
-
|
|
140
|
-
gsp:
|
|
141
|
-
gsp_zarr_path: /path/to/gsp-data.zarr
|
|
142
|
-
history_minutes: 60
|
|
143
|
-
forecast_minutes: 120
|
|
144
|
-
time_resolution_minutes: 30
|
|
145
|
-
start_datetime: "2019-01-01T00:00:00"
|
|
146
|
-
end_datetime: "2019-01-08T00:00:00"
|
|
147
|
-
metadata_only: false
|
|
148
|
-
|
|
149
|
-
nwp:
|
|
150
|
-
ukv:
|
|
151
|
-
nwp_zarr_path: /path/to/nwp-data.zarr
|
|
152
|
-
history_minutes: 60
|
|
153
|
-
forecast_minutes: 120
|
|
154
|
-
time_resolution_minutes: 60
|
|
155
|
-
nwp_channels: # comment out channels as appropriate
|
|
156
|
-
- t # 2-metre temperature
|
|
157
|
-
- dswrf # downwards short-wave radiation flux
|
|
158
|
-
- dlwrf # downwards long-wave radiation flux
|
|
159
|
-
- hcc # high cloud cover
|
|
160
|
-
- mcc # medium cloud cover
|
|
161
|
-
- lcc # low cloud cover
|
|
162
|
-
- vis # visability
|
|
163
|
-
- r # relative humidity
|
|
164
|
-
- prate # precipitation rate
|
|
165
|
-
- si10 # 10-metre wind speed | live = unknown
|
|
166
|
-
nwp_image_size_pixels_height: 24
|
|
167
|
-
nwp_image_size_pixels_width: 24
|
|
168
|
-
nwp_provider: ukv
|
|
169
|
-
|
|
170
|
-
pv:
|
|
171
|
-
pv_files_groups:
|
|
172
|
-
- label: pvoutput.org
|
|
173
|
-
pv_filename: /path/to/pv-data/pv.netcdf
|
|
174
|
-
pv_metadata_filename: /path/to/pv-data/metadata.csv
|
|
175
|
-
history_minutes: 60
|
|
176
|
-
forecast_minutes: 0 # PVNet assumes no future PV generation
|
|
177
|
-
time_resolution_minutes: 5
|
|
178
|
-
start_datetime: "2019-01-01T00:00:00"
|
|
179
|
-
end_datetime: "2019-01-08T00:00:00"
|
|
180
|
-
pv_image_size_meters_height: 24
|
|
181
|
-
pv_image_size_meters_width: 24
|
|
182
|
-
pv_ml_ids: [154,155,156,158,159,160,162,164,165,166,167,168,169,171,173,177,178,179,181,182,185,186,187,188,189,190,191,192,193,197,198,199,200,202,204,205,206,208,209,211,214,215,216,217,218,219,220,221,225,229,230,232,233,234,236,242,243,245,252,254,255,256,257,258,260,261,262,265,267,268,272,273,275,276,277,280,281,282,283,287,289,291,292,293,294,295,296,297,298,301,302,303,304,306,307,309,310,311,317,318,319,320,321,322,323,325,326,329,332,333,335,336,338,340,342,344,345,346,348,349,352,354,355,356,357,360,362,363,368,369,370,371,372,374,375,376,378,380,382,384,385,388,390,391,393,396,397,398,399,400,401,403,404,405,406,407,409,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,429,431,435,437,438,440,441,444,447,450,451,453,456,457,458,459,464,465,466,467,468,470,471,473,474,476,477,479,480,481,482,485,486,488,490,491,492,493,496,498,501,503,506,507,508,509,510,511,512,513,515,516,517,519,520,521,522,524,526,527,528,531,532,536,537,538,540,541,542,543,544,545,549,550,551,552,553,554,556,557,560,561,563,566,568,571,572,575,576,577,579,580,581,582,584,585,588,590,594,595,597,600,602,603,604,606,611,613,614,616,618,620,622,623,624,625,626,628,629,630,631,636,637,638,640,641,642,644,645,646,650,651,652,653,654,655,657,660,661,662,663,666,667,668,670,675,676,679,681,683,684,685,687,696,698,701,702,703,704,706,710,722,723,724,725,727,728,729,730,732,733,734,735,736,737,]
|
|
183
|
-
n_pv_systems_per_example: 128
|
|
184
|
-
get_center: false
|
|
185
|
-
is_live: false
|
|
186
|
-
|
|
187
|
-
satellite:
|
|
188
|
-
satellite_zarr_path: "" # Left empty to avoid using satellite data
|
|
189
|
-
history_minutes: 60
|
|
190
|
-
forecast_minutes: 0
|
|
191
|
-
live_delay_minutes: 30
|
|
192
|
-
time_resolution_minutes: 5
|
|
193
|
-
satellite_channels:
|
|
194
|
-
- IR_016
|
|
195
|
-
- IR_039
|
|
196
|
-
- IR_087
|
|
197
|
-
- IR_097
|
|
198
|
-
- IR_108
|
|
199
|
-
- IR_120
|
|
200
|
-
- IR_134
|
|
201
|
-
- VIS006
|
|
202
|
-
- VIS008
|
|
203
|
-
- WV_062
|
|
204
|
-
- WV_073
|
|
205
|
-
satellite_image_size_pixels_height: 24
|
|
206
|
-
satellite_image_size_pixels_width: 24
|
|
136
|
+
```bash
|
|
137
|
+
pip install -r requirements.txt requirements-dev.txt
|
|
207
138
|
```
|
|
208
139
|
|
|
140
|
+
Then exit this environment, and enter back into the pvnet conda environment and install ocf_datapies in editable mode (-e). This means the package is directly linked to the source code in the ocf_datapies repo.
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pip install -e <PATH-TO-ocf_datapipes-REPO>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Generating pre-made batches of data for training/validation of PVNet
|
|
147
|
+
|
|
148
|
+
PVNet contains a script for generating batches of data suitable for training the PVNet models. To run the script you will need to make some modifications to the datamodule configuration.
|
|
149
|
+
|
|
150
|
+
Make sure you have copied the example configs (as already stated above):
|
|
151
|
+
```
|
|
152
|
+
cp -r configs.example configs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Set up and config example for batch creation
|
|
156
|
+
|
|
157
|
+
We will use the example of creating batches using data from gcp:
|
|
158
|
+
`/PVNet/configs/datamodule/configuration/gcp_configuration.yaml`
|
|
159
|
+
Ensure that the file paths are set to the correct locations in
|
|
160
|
+
`gcp_configuration.yaml`.
|
|
161
|
+
|
|
162
|
+
`PLACEHOLDER` is used to indcate where to input the location of the files.
|
|
163
|
+
|
|
164
|
+
For OCF use cases, file locations can be found in `template_configuration.yaml` located alongside `gcp_configuration.yaml`.
|
|
165
|
+
|
|
166
|
+
In these configurations you can update the train, val & test periods to cover the data you have access to.
|
|
167
|
+
|
|
168
|
+
|
|
209
169
|
With your configuration in place, you can proceed to create batches. PVNet uses
|
|
210
170
|
[hydra](https://hydra.cc/) which enables us to pass variables via the command
|
|
211
171
|
line that will override the configuration defined in the `./configs` directory.
|
|
212
172
|
|
|
213
|
-
|
|
214
|
-
|
|
173
|
+
When creating batches, an additional config is used which is passed into the batch creation script. This is the datamodule config located `PVNet/configs/datamodule`.
|
|
174
|
+
|
|
175
|
+
For this example we will be using the `streamed_batches.yaml` config. Like before, a placeholder variable is used when specifing which configuration to use:
|
|
176
|
+
|
|
177
|
+
`configuration: "PLACEHOLDER.yaml"`
|
|
178
|
+
|
|
179
|
+
This should be given the whole path to the config on your local machine, such as for our example it should be changed to:
|
|
180
|
+
|
|
181
|
+
`configuration: "/FULL-PATH-TO-REPO/PVNet/configs/datamodule/configuration/gcp_configuration.yaml"
|
|
182
|
+
`
|
|
183
|
+
|
|
184
|
+
Where `FULL-PATH-TO-REPO` represent the whole path to the PVNet repo on your local machine.
|
|
185
|
+
|
|
186
|
+
### Running the batch creation script
|
|
187
|
+
|
|
188
|
+
Run the save_batches.py script to create batches with the following example arguments as:
|
|
215
189
|
|
|
216
190
|
```
|
|
217
|
-
python scripts/save_batches.py datamodule=
|
|
191
|
+
python scripts/save_batches.py datamodule=streamed_batches +batch_output_dir="./output" +num_train_batches=10 +num_val_batches=5
|
|
218
192
|
```
|
|
219
193
|
|
|
194
|
+
In this function the datamodule argument looks for a config under `PVNet/configs/datamodule`. The examples here are either to use "premade_batches" or "streamed_batches".
|
|
195
|
+
|
|
196
|
+
Its important that the dates set for the training, validation and testing in the datamodule (`streamed_batches.yaml`) config are within the ranges of the dates set for the input features in the configuration (`gcp_configuration.yaml`).
|
|
197
|
+
|
|
198
|
+
If downloading private data from a gcp bucket make sure to authenticate gcloud (the public satellite data does not need authentication):
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
gcloud auth login
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
For files stored in multiple locations they can be added as list. For example from the gcp_configuration.yaml file we can change from satellite data stored on a bucket:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
satellite:
|
|
208
|
+
satellite_zarr_path: gs://solar-pv-nowcasting-data/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
To satellite data hosted by Google:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
satellite:
|
|
215
|
+
satellite_zarr_paths:
|
|
216
|
+
- "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr"
|
|
217
|
+
- "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2021_nonhrv.zarr"
|
|
218
|
+
```
|
|
219
|
+
Datapipes is currently set up to use 11 channels from the satellite data, the 12th of which is HRV and is not included in these.
|
|
220
|
+
|
|
221
|
+
|
|
220
222
|
### Training PVNet
|
|
221
223
|
|
|
222
224
|
How PVNet is run is determined by the extensive configuration in the config
|