PVNet 4.0.2__tar.gz → 4.0.4__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-4.0.2 → pvnet-4.0.4}/PKG-INFO +4 -5
- {pvnet-4.0.2 → pvnet-4.0.4}/PVNet.egg-info/PKG-INFO +4 -5
- {pvnet-4.0.2 → pvnet-4.0.4}/PVNet.egg-info/requires.txt +1 -3
- pvnet-4.0.4/pvnet/__init__.py +2 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/multimodal_base.py +16 -11
- {pvnet-4.0.2 → pvnet-4.0.4}/pyproject.toml +51 -4
- pvnet-4.0.2/pvnet/__init__.py +0 -2
- {pvnet-4.0.2 → pvnet-4.0.4}/LICENSE +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/MANIFEST.in +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/PVNet.egg-info/SOURCES.txt +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/PVNet.egg-info/dependency_links.txt +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/PVNet.egg-info/top_level.txt +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/README.md +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/callbacks.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/data/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/data/base_datamodule.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/data/site_datamodule.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/data/uk_regional_datamodule.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/load_model.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/base_model.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/baseline/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/baseline/last_value.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/baseline/single_value.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/ensemble.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/model_cards/pv_india_model_card_template.md +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/model_cards/pv_uk_regional_model_card_template.md +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/model_cards/wind_india_model_card_template.md +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/basic_blocks.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/encoders/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/multimodal.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/multimodal/unimodal_teacher.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/models/utils.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/optimizers.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/training.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/pvnet/utils.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/setup.cfg +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/tests/test_end2end.py +0 -0
- {pvnet-4.0.2 → pvnet-4.0.4}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.4
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author-email: Peter Dudfield <info@openclimatefix.org>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -34,9 +34,7 @@ Requires-Dist: rich
|
|
|
34
34
|
Requires-Dist: gcsfs
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pvlive-api; extra == "dev"
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist: flake8; extra == "dev"
|
|
39
|
-
Requires-Dist: isort; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff; extra == "dev"
|
|
40
38
|
Requires-Dist: mypy; extra == "dev"
|
|
41
39
|
Requires-Dist: pre-commit; extra == "dev"
|
|
42
40
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -46,6 +44,7 @@ Requires-Dist: pytorch-tabnet; extra == "all-models"
|
|
|
46
44
|
Requires-Dist: efficientnet_pytorch; extra == "all-models"
|
|
47
45
|
Provides-Extra: all
|
|
48
46
|
Requires-Dist: PVNet[all_models,dev]; extra == "all"
|
|
47
|
+
Dynamic: license-file
|
|
49
48
|
|
|
50
49
|
# PVNet 2.1
|
|
51
50
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PVNet
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.4
|
|
4
4
|
Summary: PVNet
|
|
5
5
|
Author-email: Peter Dudfield <info@openclimatefix.org>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -34,9 +34,7 @@ Requires-Dist: rich
|
|
|
34
34
|
Requires-Dist: gcsfs
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pvlive-api; extra == "dev"
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist: flake8; extra == "dev"
|
|
39
|
-
Requires-Dist: isort; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff; extra == "dev"
|
|
40
38
|
Requires-Dist: mypy; extra == "dev"
|
|
41
39
|
Requires-Dist: pre-commit; extra == "dev"
|
|
42
40
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -46,6 +44,7 @@ Requires-Dist: pytorch-tabnet; extra == "all-models"
|
|
|
46
44
|
Requires-Dist: efficientnet_pytorch; extra == "all-models"
|
|
47
45
|
Provides-Extra: all
|
|
48
46
|
Requires-Dist: PVNet[all_models,dev]; extra == "all"
|
|
47
|
+
Dynamic: license-file
|
|
49
48
|
|
|
50
49
|
# PVNet 2.1
|
|
51
50
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"""Base model class for multimodal model and unimodal teacher"""
|
|
2
|
+
import copy
|
|
3
|
+
|
|
2
4
|
from torchvision.transforms.functional import center_crop
|
|
3
5
|
|
|
4
6
|
from pvnet.models.base_model import BaseModel
|
|
@@ -8,26 +10,29 @@ class MultimodalBaseModel(BaseModel):
|
|
|
8
10
|
"""Base model class for multimodal model and unimodal teacher"""
|
|
9
11
|
|
|
10
12
|
def _adapt_batch(self, batch):
|
|
11
|
-
"""Slice batches into appropriate shapes for model
|
|
13
|
+
"""Slice batches into appropriate shapes for model.
|
|
12
14
|
|
|
15
|
+
Returns a new batch dictionary with adapted data, leaving the original batch unchanged.
|
|
13
16
|
We make some specific assumptions about the original batch and the derived sliced batch:
|
|
14
17
|
- We are only limiting the future projections. I.e. we are never shrinking the batch from
|
|
15
18
|
the left hand side of the time axis, only slicing it from the right
|
|
16
19
|
- We are only shrinking the spatial crop of the satellite and NWP data
|
|
17
20
|
|
|
18
21
|
"""
|
|
22
|
+
# Create a copy of the batch to avoid modifying the original
|
|
23
|
+
new_batch = {key: copy.deepcopy(value) for key, value in batch.items()}
|
|
19
24
|
|
|
20
|
-
if "gsp" in
|
|
25
|
+
if "gsp" in new_batch.keys():
|
|
21
26
|
# Slice off the end of the GSP data
|
|
22
27
|
gsp_len = self.forecast_len + self.history_len + 1
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
new_batch["gsp"] = new_batch["gsp"][:, :gsp_len]
|
|
29
|
+
new_batch["gsp_time_utc"] = new_batch["gsp_time_utc"][:, :gsp_len]
|
|
25
30
|
|
|
26
31
|
if self.include_sat:
|
|
27
32
|
# Slice off the end of the satellite data and spatially crop
|
|
28
33
|
# Shape: batch_size, seq_length, channel, height, width
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
new_batch["satellite_actual"] = center_crop(
|
|
35
|
+
new_batch["satellite_actual"][:, : self.sat_sequence_len],
|
|
31
36
|
output_size=self.sat_encoder.image_size_pixels,
|
|
32
37
|
)
|
|
33
38
|
|
|
@@ -35,8 +40,8 @@ class MultimodalBaseModel(BaseModel):
|
|
|
35
40
|
# Slice off the end of the NWP data and spatially crop
|
|
36
41
|
for nwp_source in self.nwp_encoders_dict:
|
|
37
42
|
# shape: batch_size, seq_len, n_chans, height, width
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
new_batch["nwp"][nwp_source]["nwp"] = center_crop(
|
|
44
|
+
new_batch["nwp"][nwp_source]["nwp"],
|
|
40
45
|
output_size=self.nwp_encoders_dict[nwp_source].image_size_pixels,
|
|
41
46
|
)[:, : self.nwp_encoders_dict[nwp_source].sequence_length]
|
|
42
47
|
|
|
@@ -44,8 +49,8 @@ class MultimodalBaseModel(BaseModel):
|
|
|
44
49
|
# Slice off the end of the solar coords data
|
|
45
50
|
for s in ["solar_azimuth", "solar_elevation"]:
|
|
46
51
|
key = f"{self._target_key}_{s}"
|
|
47
|
-
if key in
|
|
52
|
+
if key in new_batch.keys():
|
|
48
53
|
sun_len = self.forecast_len + self.history_len + 1
|
|
49
|
-
|
|
54
|
+
new_batch[key] = new_batch[key][:, :sun_len]
|
|
50
55
|
|
|
51
|
-
return
|
|
56
|
+
return new_batch
|
|
@@ -45,9 +45,7 @@ readme = {file = "README.md", content-type = "text/markdown"}
|
|
|
45
45
|
[project.optional-dependencies]
|
|
46
46
|
dev=[
|
|
47
47
|
"pvlive-api",
|
|
48
|
-
"
|
|
49
|
-
"flake8",
|
|
50
|
-
"isort",
|
|
48
|
+
"ruff",
|
|
51
49
|
"mypy",
|
|
52
50
|
"pre-commit",
|
|
53
51
|
"pytest",
|
|
@@ -86,4 +84,53 @@ testpaths = [
|
|
|
86
84
|
|
|
87
85
|
[tool.ruff]
|
|
88
86
|
line-length = 100
|
|
89
|
-
exclude = [
|
|
87
|
+
exclude = [
|
|
88
|
+
".ipynb_checkpoints",
|
|
89
|
+
"configs.example",
|
|
90
|
+
".bzr",
|
|
91
|
+
".direnv",
|
|
92
|
+
".eggs",
|
|
93
|
+
".git",
|
|
94
|
+
".hg",
|
|
95
|
+
".mypy_cache",
|
|
96
|
+
".nox",
|
|
97
|
+
".pants.d",
|
|
98
|
+
".pytype",
|
|
99
|
+
".ruff_cache",
|
|
100
|
+
".svn",
|
|
101
|
+
".tox",
|
|
102
|
+
".venv",
|
|
103
|
+
"__pypackages__",
|
|
104
|
+
"_build",
|
|
105
|
+
"buck-out",
|
|
106
|
+
"build",
|
|
107
|
+
"dist",
|
|
108
|
+
"node_modules",
|
|
109
|
+
"venv",
|
|
110
|
+
"tests",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
# Assume Python 3.10.
|
|
114
|
+
target-version = "py310"
|
|
115
|
+
fix = false
|
|
116
|
+
|
|
117
|
+
[tool.ruff.lint]
|
|
118
|
+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
119
|
+
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
|
120
|
+
fixable = ["A", "B", "C", "D", "E", "F", "I"]
|
|
121
|
+
unfixable = []
|
|
122
|
+
select = ["E", "F", "D", "I"]
|
|
123
|
+
ignore-init-module-imports = true
|
|
124
|
+
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
|
|
125
|
+
ignore = ["D200","D202","D210","D212","D415","D105",]
|
|
126
|
+
|
|
127
|
+
[tool.ruff.lint.mccabe]
|
|
128
|
+
# Unlike Flake8, default to a complexity level of 10.
|
|
129
|
+
max-complexity = 10
|
|
130
|
+
|
|
131
|
+
[tool.ruff.lint.pydocstyle]
|
|
132
|
+
# Use Google-style docstrings.
|
|
133
|
+
convention = "google"
|
|
134
|
+
|
|
135
|
+
[tool.ruff.lint.per-file-ignores]
|
|
136
|
+
"__init__.py" = ["F401", "E402"]
|
pvnet-4.0.2/pvnet/__init__.py
DELETED
|
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
|
|
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
|
|
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
|