PVNet 3.0.36__tar.gz → 3.0.37__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.
Files changed (49) hide show
  1. {pvnet-3.0.36 → pvnet-3.0.37}/PKG-INFO +6 -1
  2. {pvnet-3.0.36 → pvnet-3.0.37}/PVNet.egg-info/PKG-INFO +6 -1
  3. {pvnet-3.0.36 → pvnet-3.0.37}/PVNet.egg-info/SOURCES.txt +2 -1
  4. {pvnet-3.0.36 → pvnet-3.0.37}/README.md +5 -0
  5. pvnet-3.0.37/pvnet/__init__.py +2 -0
  6. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/data/pv_site_datamodule.py +1 -1
  7. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/utils.py +28 -0
  8. pvnet-3.0.37/tests/test_utils.py +38 -0
  9. pvnet-3.0.36/pvnet/__init__.py +0 -2
  10. {pvnet-3.0.36 → pvnet-3.0.37}/LICENSE +0 -0
  11. {pvnet-3.0.36 → pvnet-3.0.37}/MANIFEST.in +0 -0
  12. {pvnet-3.0.36 → pvnet-3.0.37}/PVNet.egg-info/dependency_links.txt +0 -0
  13. {pvnet-3.0.36 → pvnet-3.0.37}/PVNet.egg-info/requires.txt +0 -0
  14. {pvnet-3.0.36 → pvnet-3.0.37}/PVNet.egg-info/top_level.txt +0 -0
  15. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/callbacks.py +0 -0
  16. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/data/__init__.py +0 -0
  17. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/data/base.py +0 -0
  18. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/data/datamodule.py +0 -0
  19. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/data/utils.py +0 -0
  20. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/data/wind_datamodule.py +0 -0
  21. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/load_model.py +0 -0
  22. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/__init__.py +0 -0
  23. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/base_model.py +0 -0
  24. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/baseline/__init__.py +0 -0
  25. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/baseline/last_value.py +0 -0
  26. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/baseline/single_value.py +0 -0
  27. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/ensemble.py +0 -0
  28. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/__init__.py +0 -0
  29. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/basic_blocks.py +0 -0
  30. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/encoders/__init__.py +0 -0
  31. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
  32. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
  33. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
  34. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
  35. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
  36. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
  37. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
  38. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/multimodal.py +0 -0
  39. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/multimodal_base.py +0 -0
  40. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
  41. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
  42. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
  43. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/multimodal/unimodal_teacher.py +0 -0
  44. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/models/utils.py +0 -0
  45. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/optimizers.py +0 -0
  46. {pvnet-3.0.36 → pvnet-3.0.37}/pvnet/training.py +0 -0
  47. {pvnet-3.0.36 → pvnet-3.0.37}/pyproject.toml +0 -0
  48. {pvnet-3.0.36 → pvnet-3.0.37}/setup.cfg +0 -0
  49. {pvnet-3.0.36 → pvnet-3.0.37}/tests/test_end2end.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PVNet
3
- Version: 3.0.36
3
+ Version: 3.0.37
4
4
  Summary: PVNet
5
5
  Author-email: Peter Dudfield <info@openclimatefix.org>
6
6
  Description-Content-Type: text/markdown
@@ -391,6 +391,11 @@ val data batches, you can now train PVNet by running:
391
391
  python run.py
392
392
  ```
393
393
 
394
+ ## Backtest
395
+
396
+ If you have succesfully 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.
397
+
398
+
394
399
  ## Testing
395
400
 
396
401
  You can use `python -m pytest tests` to run tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PVNet
3
- Version: 3.0.36
3
+ Version: 3.0.37
4
4
  Summary: PVNet
5
5
  Author-email: Peter Dudfield <info@openclimatefix.org>
6
6
  Description-Content-Type: text/markdown
@@ -391,6 +391,11 @@ val data batches, you can now train PVNet by running:
391
391
  python run.py
392
392
  ```
393
393
 
394
+ ## Backtest
395
+
396
+ If you have succesfully 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.
397
+
398
+
394
399
  ## Testing
395
400
 
396
401
  You can use `python -m pytest tests` to run tests
@@ -42,4 +42,5 @@ pvnet/models/multimodal/linear_networks/networks.py
42
42
  pvnet/models/multimodal/site_encoders/__init__.py
43
43
  pvnet/models/multimodal/site_encoders/basic_blocks.py
44
44
  pvnet/models/multimodal/site_encoders/encoders.py
45
- tests/test_end2end.py
45
+ tests/test_end2end.py
46
+ tests/test_utils.py
@@ -343,6 +343,11 @@ val data batches, you can now train PVNet by running:
343
343
  python run.py
344
344
  ```
345
345
 
346
+ ## Backtest
347
+
348
+ If you have succesfully 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.
349
+
350
+
346
351
  ## Testing
347
352
 
348
353
  You can use `python -m pytest tests` to run tests
@@ -0,0 +1,2 @@
1
+ """PVNet"""
2
+ __version__ = "3.0.37"
@@ -34,7 +34,7 @@ class PVSiteDataModule(BaseDataModule):
34
34
  def _get_premade_batches_datapipe(self, subdir, shuffle=False):
35
35
  filenames = list(glob.glob(f"{self.batch_dir}/{subdir}/*.nc"))
36
36
  data_pipeline = pvnet_site_netcdf_datapipe(
37
- keys=["pv", "nwp"],
37
+ keys=["pv", "nwp"], # add other keys e.g. sat if used as input in site model
38
38
  filenames=filenames,
39
39
  )
40
40
  data_pipeline = (
@@ -69,6 +69,34 @@ class GSPLocationLookup:
69
69
  )
70
70
 
71
71
 
72
+ class SiteLocationLookup:
73
+ """Query object for site location from site ID"""
74
+
75
+ def __init__(self, long: xr.DataArray, lat: xr.DataArray):
76
+ """Query object for site location from site ID
77
+
78
+ Args:
79
+ long: DataArray of the longitude coordinates for any given site ID
80
+ lat: DataArray of the latitude coordinates for any given site ID
81
+
82
+ """
83
+ self.longitude = long
84
+ self.latitude = lat
85
+
86
+ def __call__(self, site_id: int) -> Location:
87
+ """Returns the locations for the input site IDs.
88
+
89
+ Args:
90
+ site_id: Integer ID of the site
91
+ """
92
+ return Location(
93
+ coordinate_system="lon_lat",
94
+ x=self.longitude.sel(pv_system_id=site_id).item(),
95
+ y=self.latitude.sel(pv_system_id=site_id).item(),
96
+ id=site_id,
97
+ )
98
+
99
+
72
100
  def extras(config: DictConfig) -> None:
73
101
  """A couple of optional utilities.
74
102
 
@@ -0,0 +1,38 @@
1
+ from ocf_datapipes.utils.location import Location
2
+ from pvnet.utils import SiteLocationLookup
3
+ import xarray as xr
4
+ import pytest
5
+
6
+
7
+ @pytest.mark.parametrize(
8
+ "lookup_site_id, expected_x, expected_y, expected_id",
9
+ [
10
+ (1, -1.99106, 48.709865, 1),
11
+ (0, 0.30693, 51.509865, 0),
12
+ (2, -1.56106, 56.203865, 2),
13
+ ],
14
+ )
15
+ def test_site_location_lookup(lookup_site_id, expected_x, expected_y, expected_id):
16
+ # setup
17
+ site_ids = [0, 1, 2]
18
+ longs = [0.30693, -1.99106, -1.56106]
19
+ lats = [51.509865, 48.709865, 56.203865]
20
+ da_long = xr.DataArray(
21
+ data=longs,
22
+ dims="pv_system_id",
23
+ coords=dict(site_id=(["pv_system_id"], site_ids), long=(["pv_system_id"], longs)),
24
+ )
25
+ da_lat = xr.DataArray(
26
+ data=lats,
27
+ dims="pv_system_id",
28
+ coords=dict(site_id=(["pv_system_id"], site_ids), long=(["pv_system_id"], lats)),
29
+ )
30
+ # Actual testing part
31
+ site_lookup = SiteLocationLookup(long=da_long, lat=da_lat)
32
+
33
+ # retrieve location of site 1
34
+ site_location: Location = site_lookup(lookup_site_id)
35
+
36
+ assert site_location.x == expected_x
37
+ assert site_location.y == expected_y
38
+ assert site_location.id == expected_id
@@ -1,2 +0,0 @@
1
- """PVNet"""
2
- __version__ = "3.0.36"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes