PVNet 5.0.17__py3-none-any.whl → 5.0.19__py3-none-any.whl

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.
@@ -16,6 +16,7 @@ class AbstractNWPSatelliteEncoder(nn.Module, metaclass=ABCMeta):
16
16
  self,
17
17
  sequence_length: int,
18
18
  image_size_pixels: int,
19
+ in_channels: int,
19
20
  out_features: int,
20
21
  ):
21
22
  """Abstract class for NWP/satellite encoder.
@@ -24,7 +24,7 @@ class DefaultPVNet(AbstractNWPSatelliteEncoder):
24
24
  fc_features: int = 128,
25
25
  spatial_kernel_size: int = 3,
26
26
  temporal_kernel_size: int = 3,
27
- padding: int | tuple[int] = (1, 0, 0),
27
+ padding: int | tuple[int, ...] = (1, 0, 0),
28
28
  ):
29
29
  """This is the original encoding module used in PVNet, with a few minor tweaks.
30
30
 
@@ -42,7 +42,7 @@ class DefaultPVNet(AbstractNWPSatelliteEncoder):
42
42
  is used in all dimensions
43
43
  """
44
44
 
45
- super().__init__(sequence_length, image_size_pixels, out_features)
45
+ super().__init__(sequence_length, image_size_pixels, in_channels, out_features)
46
46
 
47
47
  if isinstance(padding, int):
48
48
  padding = (padding, padding, padding)
@@ -137,7 +137,7 @@ class ResConv3DNet(AbstractNWPSatelliteEncoder):
137
137
  batch_norm: Whether to include batch normalisation.
138
138
  dropout_frac: Probability of an element to be zeroed in the residual pathways.
139
139
  """
140
- super().__init__(sequence_length, image_size_pixels, out_features)
140
+ super().__init__(sequence_length, image_size_pixels, in_channels, out_features)
141
141
 
142
142
  model = [
143
143
  nn.Conv3d(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PVNet
3
- Version: 5.0.17
3
+ Version: 5.0.19
4
4
  Summary: PVNet
5
5
  Author-email: Peter Dudfield <info@openclimatefix.org>
6
6
  Requires-Python: >=3.11
@@ -142,120 +142,75 @@ pip install -e <PATH-TO-ocf-data-sampler-REPO>
142
142
  If you install the local version of `ocf-data-sampler` that is more recent than the version
143
143
  specified in `PVNet` it is not guarenteed to function properly with this library.
144
144
 
145
- ## Pre-saving samples of data for training/validation of PVNet
145
+ ## Streaming samples (no pre-save)
146
146
 
147
- PVNet contains a script for generating samples of data suitable for training the PVNet models. To run the script you will need to make some modifications to the datamodule configuration.
147
+ PVNet now trains and validates directly from **streamed_samples** (i.e. no pre-saving to disk).
148
148
 
149
- Make sure you have copied the example configs (as already stated above):
150
- ```
149
+ Make sure you have copied example configs (as already stated above):
151
150
  cp -r configs.example configs
152
- ```
153
-
154
- ### Set up and config example for sample creation
155
-
156
- We will use the following example config file for creating samples: `/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. You will need to comment out or delete the parts of `example_configuration.yaml` pertaining to the data you are not using.
157
151
 
152
+ ### Set up and config example for streaming
158
153
 
159
- When creating samples, an additional datamodule config located in `PVNet/configs/datamodule` is passed into the sample creation script: `streamed_samples.yaml`. Like before, a placeholder variable is used when specifying which configuration to use:
154
+ 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.
160
155
 
161
- ```yaml
162
- configuration: "PLACEHOLDER.yaml"
163
- ```
164
-
165
- This should be given the whole path to the config on your local machine, for example:
156
+ At run time, the datamodule config `PVNet/configs/datamodule/streamed_samples.yaml` points to your chosen configuration file:
166
157
 
167
- ```yaml
168
158
  configuration: "/FULL-PATH-TO-REPO/PVNet/configs/datamodule/configuration/example_configuration.yaml"
169
- ```
170
-
171
- Where `FULL-PATH-TO-REPO` represent the whole path to the PVNet repo on your local machine.
172
159
 
173
- This is also where you can update the train, val & test periods to cover the data you have access to.
174
-
175
- ### Running the sample creation script
176
-
177
- Run the `save_samples.py` script to create samples with the parameters specified in the datamodule config (`streamed_samples.yaml` in this example):
178
-
179
- ```bash
180
- python scripts/save_samples.py
181
- ```
182
- PVNet uses
183
- [hydra](https://hydra.cc/) which enables us to pass variables via the command
184
- line that will override the configuration defined in the `./configs` directory, like this:
185
-
186
- ```bash
187
- python scripts/save_samples.py datamodule=streamed_samples datamodule.sample_output_dir="./output" datamodule.num_train_samples=10 datamodule.num_val_samples=5
188
- ```
189
-
190
- `scripts/save_samples.py` needs a config under `PVNet/configs/datamodule`. You can adapt `streamed_samples.yaml` or create your own in the same folder.
160
+ You can also update train/val/test time ranges here to match the period you have access to.
191
161
 
192
162
  If downloading private data from a GCP bucket make sure to authenticate gcloud (the public satellite data does not need authentication):
193
163
 
194
- ```
195
164
  gcloud auth login
196
- ```
197
-
198
- Files stored in multiple locations can be added as a list. For example, in the `example_configuration.yaml` file we can supply a path to satellite data stored on a bucket:
199
165
 
200
- ```yaml
201
- satellite:
202
- zarr_path: gs://solar-pv-nowcasting-data/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr
203
- ```
166
+ You can provide multiple storage locations as a list. For example:
204
167
 
205
- Or to satellite data hosted by Google:
206
-
207
- ```yaml
208
168
  satellite:
209
- zarr_path:
210
- - "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr"
211
- - "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2021_nonhrv.zarr"
212
- ```
213
-
214
- ocf-data-sampler is currently set up to use 11 channels from the satellite data, the 12th of which is HRV and is not included in these.
169
+ zarr_path:
170
+ - "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2020_nonhrv.zarr"
171
+ - "gs://public-datasets-eumetsat-solar-forecasting/satellite/EUMETSAT/SEVIRI_RSS/v4/2021_nonhrv.zarr"
215
172
 
173
+ `ocf-data-sampler` is currently set up to use 11 channels from the satellite data (the 12th, HRV, is not used).
216
174
 
217
175
  ### Training PVNet
218
176
 
219
- How PVNet is run is determined by the extensive configuration in the config
220
- files. The configs stored in `PVNet/configs.example` should work with samples created using the steps and sample creation config mentioned above.
177
+ 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`.
221
178
 
222
- Make sure to update the following config files before training your model:
179
+ Update the following before training:
223
180
 
224
- 1. In `configs/datamodule/presaved_samples.yaml`:
225
- - update `sample_dir` to point to the directory you stored your samples in during sample creation
226
- 2. In `configs/model/late_fusion.yaml`:
227
- - update the list of encoders to reflect the data sources you are using. If you are using different NWP sources, the encoders for these should follow the same structure with two important updates:
228
- - `in_channels`: number of variables your NWP source supplies
229
- - `image_size_pixels`: spatial crop of your NWP data. It depends on the spatial resolution of your NWP; should match `image_size_pixels_height` and/or `image_size_pixels_width` in `datamodule/configuration/site_example_configuration.yaml` for the NWP, unless transformations such as coarsening was applied (e. g. as for ECMWF data)
230
- 3. In `configs/trainer/default.yaml`:
231
- - set `accelerator: 0` if running on a system without a supported GPU
181
+ 1. In `configs/model/late_fusion.yaml`:
182
+ - Update the list of encoders to match the data sources you are using. For different NWP sources, keep the same structure but ensure:
183
+ - `in_channels`: the number of variables your NWP source supplies
184
+ - `image_size_pixels`: spatial crop matching your NWP resolution and the settings in your datamodule configuration (unless you coarsened, e.g. for ECMWF)
185
+ 2. In `configs/trainer/default.yaml`:
186
+ - Set `accelerator: 0` if running on a system without a supported GPU
187
+ 3. In `configs/datamodule/streamed_samples.yaml`:
188
+ - Point `configuration:` to your local `example_configuration.yaml` (or your custom one)
189
+ - Adjust the train/val/test time ranges to your available data
232
190
 
233
- If creating copies of the config files instead of modifying existing ones, update `defaults` in the main `./configs/config.yaml` file to use
234
- your customised config files:
191
+ If you create custom config files, update the main `./configs/config.yaml` defaults:
235
192
 
236
- ```yaml
237
193
  defaults:
238
194
  - trainer: default.yaml
239
195
  - model: late_fusion.yaml
240
- - datamodule: presaved_samples.yaml
196
+ - datamodule: streamed_samples.yaml
241
197
  - callbacks: null
242
198
  - experiment: null
243
199
  - hparams_search: null
244
200
  - hydra: default.yaml
245
- ```
246
201
 
247
- Assuming you ran the `save_samples.py` script to generate some presaved train and
248
- val data samples, you can now train PVNet by running:
202
+ Now train PVNet:
249
203
 
250
- ```
251
204
  python run.py
252
- ```
205
+
206
+ You can override any setting with Hydra, e.g.:
207
+
208
+ python run.py datamodule=streamed_samples datamodule.configuration="/FULL-PATH/PVNet/configs/datamodule/configuration/example_configuration.yaml"
253
209
 
254
210
  ## Backtest
255
211
 
256
212
  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](scripts/backtest_uk_gsp.py) or the [the pv site backtest script](scripts/backtest_sites.py), further info on how to run these are in each backtest file.
257
213
 
258
-
259
214
  ## Testing
260
215
 
261
216
  You can use `python -m pytest tests` to run tests
@@ -13,8 +13,8 @@ pvnet/models/late_fusion/__init__.py,sha256=Jf0B-E0_5IvSBFoj1wvnPtwYDxs4pRIFm5qH
13
13
  pvnet/models/late_fusion/basic_blocks.py,sha256=_cYGVyAIyEJS4wd-DEAXQXu0br66guZJn3ugoebWqZ0,1479
14
14
  pvnet/models/late_fusion/late_fusion.py,sha256=VpP1aY646iO-JBlYkyoBlj0Z-gzsqaHnMgpNzjTqAIo,15735
15
15
  pvnet/models/late_fusion/encoders/__init__.py,sha256=bLBQdnCeLYhwISW0t88ZZBz-ebS94m7ZwBcsofWMHR4,51
16
- pvnet/models/late_fusion/encoders/basic_blocks.py,sha256=Yg0Pch0nOdvXjxFln_yZyEeyWYUlSUjbnXhZIEdhHdw,3018
17
- pvnet/models/late_fusion/encoders/encoders3d.py,sha256=pZ_QnCcvJv2Dw64ielFFfK_4rxxYy7bvNrb_9l4RZyQ,6620
16
+ pvnet/models/late_fusion/encoders/basic_blocks.py,sha256=DGkFFIZv4S4FLTaAIOrAngAFBpgZQHfkGM4dzezZLk4,3044
17
+ pvnet/models/late_fusion/encoders/encoders3d.py,sha256=V6yMQp9CANiJi1Km4Y0nVT7IQMrBSNCPjJdxgg5TSj4,6651
18
18
  pvnet/models/late_fusion/linear_networks/__init__.py,sha256=16dLdGfH4QWNrI1fUB-cXWx24lArqo2lWIjdUCWbcBY,96
19
19
  pvnet/models/late_fusion/linear_networks/basic_blocks.py,sha256=RnwdeuX_-itY4ncM0NphZ5gRSOpogo7927XIlZJ9LM0,2787
20
20
  pvnet/models/late_fusion/linear_networks/networks.py,sha256=exEIz_Z85f8nSwcvp4wqiiLECEAg9YbkKhSZJvFy75M,2231
@@ -25,8 +25,8 @@ pvnet/training/__init__.py,sha256=FKxmPZ59Vuj5_mXomN4saJ3En5M-aDMxSs6OttTQOcg,49
25
25
  pvnet/training/lightning_module.py,sha256=TkvLtOPswRtTIwcmAvNOSHg2RvIMzHsJVvs_d0xiRmQ,12891
26
26
  pvnet/training/plots.py,sha256=4xID7TBA4IazaARaCN5AoG5fFPJF1wIprn0y6I0C31c,2469
27
27
  pvnet/training/train.py,sha256=1tDA34ianCRfilS0yEeIpR9nsQWaJiiZfTD2qRUmgEc,5214
28
- pvnet-5.0.17.dist-info/licenses/LICENSE,sha256=tKUnlSmcLBWMJWkHx3UjZGdrjs9LidGwLo0jsBUBAwU,1077
29
- pvnet-5.0.17.dist-info/METADATA,sha256=WxuG2XNuflRMoDdvhU6tpojEv9vf6OfivvEudSTbB2c,18017
30
- pvnet-5.0.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- pvnet-5.0.17.dist-info/top_level.txt,sha256=4mg6WjeW05SR7pg3-Q4JRE2yAoutHYpspOsiUzYVNv0,6
32
- pvnet-5.0.17.dist-info/RECORD,,
28
+ pvnet-5.0.19.dist-info/licenses/LICENSE,sha256=tKUnlSmcLBWMJWkHx3UjZGdrjs9LidGwLo0jsBUBAwU,1077
29
+ pvnet-5.0.19.dist-info/METADATA,sha256=ZbWzUJKm_JA5rz7EYvaxA1k6WkUpMfitrrX5XxcF6fc,16104
30
+ pvnet-5.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ pvnet-5.0.19.dist-info/top_level.txt,sha256=4mg6WjeW05SR7pg3-Q4JRE2yAoutHYpspOsiUzYVNv0,6
32
+ pvnet-5.0.19.dist-info/RECORD,,
File without changes