ocf-data-sampler 0.5.25__py3-none-any.whl → 0.5.27__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.
Potentially problematic release.
This version of ocf-data-sampler might be problematic. Click here for more details.
- ocf_data_sampler/load/site.py +19 -14
- ocf_data_sampler/torch_datasets/datasets/pvnet_uk.py +1 -3
- ocf_data_sampler/torch_datasets/datasets/site.py +0 -2
- {ocf_data_sampler-0.5.25.dist-info → ocf_data_sampler-0.5.27.dist-info}/METADATA +1 -1
- {ocf_data_sampler-0.5.25.dist-info → ocf_data_sampler-0.5.27.dist-info}/RECORD +7 -7
- {ocf_data_sampler-0.5.25.dist-info → ocf_data_sampler-0.5.27.dist-info}/WHEEL +0 -0
- {ocf_data_sampler-0.5.25.dist-info → ocf_data_sampler-0.5.27.dist-info}/top_level.txt +0 -0
ocf_data_sampler/load/site.py
CHANGED
|
@@ -31,9 +31,10 @@ def open_site(generation_file_path: str, metadata_file_path: str) -> xr.DataArra
|
|
|
31
31
|
capacity_kwp=("site_id", metadata_df["capacity_kwp"].values),
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
# Sanity checks
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
# Sanity checks, to prevent inf or negative values
|
|
35
|
+
# Note NaNs are allowed in generation_kw as can have non overlapping time periods for sites
|
|
36
|
+
if np.isinf(generation_ds.generation_kw.values).all():
|
|
37
|
+
raise ValueError("generation_kw contains infinite (+/- inf) values")
|
|
37
38
|
if not (generation_ds.capacity_kwp.values > 0).all():
|
|
38
39
|
raise ValueError("capacity_kwp contains non-positive values")
|
|
39
40
|
|
|
@@ -43,17 +44,21 @@ def open_site(generation_file_path: str, metadata_file_path: str) -> xr.DataArra
|
|
|
43
44
|
if not np.issubdtype(site_da.dtype, np.floating):
|
|
44
45
|
raise TypeError(f"Generation data should be float, not {site_da.dtype}")
|
|
45
46
|
|
|
47
|
+
|
|
46
48
|
coord_dtypes = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if not np.issubdtype(site_da.coords[coord].dtype, expected_dtype):
|
|
49
|
+
"time_utc": (np.datetime64,),
|
|
50
|
+
"site_id": (np.integer,),
|
|
51
|
+
"capacity_kwp": (np.integer, np.floating),
|
|
52
|
+
"latitude": (np.floating,),
|
|
53
|
+
"longitude": (np.floating,),
|
|
54
|
+
}
|
|
55
|
+
for coord, expected_dtypes in coord_dtypes.items():
|
|
56
|
+
if not any(np.issubdtype(site_da.coords[coord].dtype, dt) for dt in expected_dtypes):
|
|
56
57
|
dtype = site_da.coords[coord].dtype
|
|
57
|
-
|
|
58
|
+
allowed = ", ".join(dt.__name__ for dt in expected_dtypes)
|
|
59
|
+
raise TypeError(f"{coord} should be one of ({allowed}), not {dtype}")
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
# Load the data eagerly into memory by calling compute
|
|
62
|
+
# this makes the dataset faster to sample from, but
|
|
63
|
+
# at the cost of a little extra memory usage
|
|
64
|
+
return site_da.compute()
|
|
@@ -267,10 +267,8 @@ class PVNetUKRegionalDataset(AbstractPVNetUKDataset):
|
|
|
267
267
|
|
|
268
268
|
@override
|
|
269
269
|
def __getitem__(self, idx: int) -> NumpySample:
|
|
270
|
-
# Get the coordinates of the sample
|
|
271
|
-
|
|
272
|
-
idx = int(idx)
|
|
273
270
|
|
|
271
|
+
# Get the coordinates of the sample
|
|
274
272
|
if idx >= len(self):
|
|
275
273
|
raise ValueError(f"Index {idx} out of range for dataset of length {len(self)}")
|
|
276
274
|
|
|
@@ -11,7 +11,7 @@ ocf_data_sampler/load/gsp.py,sha256=zsQ39dZBS45qd86lGfCZUjheLRTtMzIUozj-j8c87UQ,
|
|
|
11
11
|
ocf_data_sampler/load/load_dataset.py,sha256=K8rWykjII-3g127If7WRRFivzHNx3SshCvZj4uQlf28,2089
|
|
12
12
|
ocf_data_sampler/load/open_xarray_tensorstore.py,sha256=YglCBeKa4mSjUU5qlcMOLZXUtFrPFWVKDeKHLjs_YbA,6353
|
|
13
13
|
ocf_data_sampler/load/satellite.py,sha256=5o5SfcplQfZFlm3JJq73j8_m_cWKpFtKk0tTKGjjCuE,1856
|
|
14
|
-
ocf_data_sampler/load/site.py,sha256=
|
|
14
|
+
ocf_data_sampler/load/site.py,sha256=bpFABjpvlstn6yJ6OPVlPZms-CjJdxNwCkQafpnj0Ik,2539
|
|
15
15
|
ocf_data_sampler/load/utils.py,sha256=AGL0aOOQPrgqNBTjlBtR7Qg1PyQov3DFJo-y198u8pY,2044
|
|
16
16
|
ocf_data_sampler/load/nwp/__init__.py,sha256=SmcrnbygO5xtCKmGR4wtHrj-HI7nOAvnAtfuvRufBGQ,25
|
|
17
17
|
ocf_data_sampler/load/nwp/nwp.py,sha256=0E9shei3Mq1N7F-fBlEKY5Hm0_kI7ysY_rffnWIshvk,3612
|
|
@@ -42,8 +42,8 @@ ocf_data_sampler/select/select_spatial_slice.py,sha256=NB6NtZBc_Mb5zPCItzBIEa_Nr
|
|
|
42
42
|
ocf_data_sampler/select/select_time_slice.py,sha256=cpkdovJMvcjxSGfq9G0OJK5aDAeCXg7exWYrJnR4N2w,4116
|
|
43
43
|
ocf_data_sampler/torch_datasets/datasets/__init__.py,sha256=o0SsEXXZ6k9iL__5_RN1Sf60lw_eqK91P3UFEHAD2k0,102
|
|
44
44
|
ocf_data_sampler/torch_datasets/datasets/picklecache.py,sha256=b8T5lgKfiPXLwuVQuFpCQBlU-HNBrA-Z-eSwYICKvsQ,1350
|
|
45
|
-
ocf_data_sampler/torch_datasets/datasets/pvnet_uk.py,sha256=
|
|
46
|
-
ocf_data_sampler/torch_datasets/datasets/site.py,sha256=
|
|
45
|
+
ocf_data_sampler/torch_datasets/datasets/pvnet_uk.py,sha256=C4bQBBjfpuBPFVaOg2v2icn1x0HTxwkgOXJk1FvUK5g,12343
|
|
46
|
+
ocf_data_sampler/torch_datasets/datasets/site.py,sha256=WmRDY99D-2Chf0aoKE-m2bfqk0b9wRtKwMeE10l5r2w,15855
|
|
47
47
|
ocf_data_sampler/torch_datasets/sample/__init__.py,sha256=GL84vdZl_SjHDGVyh9Uekx2XhPYuZ0dnO3l6f6KXnHI,100
|
|
48
48
|
ocf_data_sampler/torch_datasets/sample/base.py,sha256=cQ1oIyhdmlotejZK8B3Cw6MNvpdnBPD8G_o2h7Ye4Vc,2206
|
|
49
49
|
ocf_data_sampler/torch_datasets/sample/site.py,sha256=40NwNTqjL1WVhPdwe02zDHHfDLG2u_bvCfRCtGAtFc0,1466
|
|
@@ -59,7 +59,7 @@ ocf_data_sampler/torch_datasets/utils/valid_time_periods.py,sha256=xcy75cVxl0Wrg
|
|
|
59
59
|
ocf_data_sampler/torch_datasets/utils/validation_utils.py,sha256=YqmT-lExWlI8_ul3l0EP73Ik002fStr_bhsZh9mQqEU,4735
|
|
60
60
|
scripts/download_gsp_location_data.py,sha256=rRDXMoqX-RYY4jPdxhdlxJGhWdl6r245F5UARgKV6P4,3121
|
|
61
61
|
scripts/refactor_site.py,sha256=skzvsPP0Cn9yTKndzkilyNcGz4DZ88ctvCJ0XrBdc2A,3135
|
|
62
|
-
ocf_data_sampler-0.5.
|
|
63
|
-
ocf_data_sampler-0.5.
|
|
64
|
-
ocf_data_sampler-0.5.
|
|
65
|
-
ocf_data_sampler-0.5.
|
|
62
|
+
ocf_data_sampler-0.5.27.dist-info/METADATA,sha256=gv6YJ9Sp4vCadQFNDFxZl-b9UC4G4iHC6TZQ4L5I2P4,13541
|
|
63
|
+
ocf_data_sampler-0.5.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
64
|
+
ocf_data_sampler-0.5.27.dist-info/top_level.txt,sha256=deUxqmsONNAGZDNbsntbXH7BRA1MqWaUeAJrCo6q_xA,25
|
|
65
|
+
ocf_data_sampler-0.5.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|