ocf-data-sampler 0.2.23__py3-none-any.whl → 0.2.25__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.

@@ -291,6 +291,8 @@ class GSP(TimeWindowMixin, DropoutMixin):
291
291
  description="Version of the GSP boundaries to use. Options are '20220314' or '20250109'.",
292
292
  )
293
293
 
294
+ public: bool = Field(False, description="Whether the NWP data is public or private")
295
+
294
296
 
295
297
  class Site(TimeWindowMixin, DropoutMixin):
296
298
  """Site configuration model."""
@@ -26,13 +26,17 @@ def get_gsp_boundaries(version: str) -> pd.DataFrame:
26
26
  )
27
27
 
28
28
 
29
- def open_gsp(zarr_path: str, boundaries_version: str = "20220314") -> xr.DataArray:
29
+ def open_gsp(zarr_path: str,
30
+ boundaries_version: str = "20220314",
31
+ public: bool = False,
32
+ ) -> xr.DataArray:
30
33
  """Open the GSP data.
31
34
 
32
35
  Args:
33
36
  zarr_path: Path to the GSP zarr data
34
37
  boundaries_version: Version of the GSP boundaries to use. Options are "20220314" or
35
38
  "20250109".
39
+ public: Whether the data is public or private.
36
40
 
37
41
  Returns:
38
42
  xr.DataArray: The opened GSP data
@@ -40,12 +44,18 @@ def open_gsp(zarr_path: str, boundaries_version: str = "20220314") -> xr.DataArr
40
44
  # Load UK GSP locations
41
45
  df_gsp_loc = get_gsp_boundaries(boundaries_version)
42
46
 
47
+ backend_kwargs ={}
43
48
  # Open the GSP generation data
49
+ if public:
50
+ backend_kwargs ={"storage_options":{"anon": True}}
51
+ # Currently only compatible with S3 bucket.
52
+
44
53
  ds = (
45
- xr.open_zarr(zarr_path)
54
+ xr.open_dataset(zarr_path,engine="zarr",backend_kwargs=backend_kwargs)
46
55
  .rename({"datetime_gmt": "time_utc"})
47
56
  )
48
57
 
58
+
49
59
  if not (ds.gsp_id.isin(df_gsp_loc.index)).all():
50
60
  raise ValueError(
51
61
  "Some GSP IDs in the GSP generation data are not available in the locations file.",
@@ -24,6 +24,7 @@ def get_dataset_dict(
24
24
  da_gsp = open_gsp(
25
25
  zarr_path=input_config.gsp.zarr_path,
26
26
  boundaries_version=input_config.gsp.boundaries_version,
27
+ public=input_config.gsp.public,
27
28
  ).compute()
28
29
 
29
30
  if gsp_ids is None:
@@ -239,8 +239,19 @@ def select_spatial_slice_pixels(
239
239
  if allow_partial_slice:
240
240
  da = _select_padded_slice(da, left_idx, right_idx, bottom_idx, top_idx, x_dim, y_dim)
241
241
  else:
242
+ issues = []
243
+ if left_idx < 0:
244
+ issues.append(f"left_idx ({left_idx}) < 0")
245
+ if right_idx > data_width_pixels:
246
+ issues.append(f"right_idx ({right_idx}) > data_width_pixels ({data_width_pixels})")
247
+ if bottom_idx < 0:
248
+ issues.append(f"bottom_idx ({bottom_idx}) < 0")
249
+ if top_idx > data_height_pixels:
250
+ issues.append(f"top_idx ({top_idx}) > data_height_pixels ({data_height_pixels})")
251
+ issue_details = "\n".join(issues)
242
252
  raise ValueError(
243
- f"Window for location {location} not available. Padding required. "
253
+ f"Window for location {location} not available. Padding required due to: \n"
254
+ f"{issue_details}\n"
244
255
  "You may wish to set `allow_partial_slice=True`",
245
256
  )
246
257
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocf-data-sampler
3
- Version: 0.2.23
3
+ Version: 0.2.25
4
4
  Author: James Fulton, Peter Dudfield
5
5
  Author-email: Open Climate Fix team <info@openclimatefix.org>
6
6
  License: MIT License
@@ -2,13 +2,13 @@ ocf_data_sampler/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,
2
2
  ocf_data_sampler/utils.py,sha256=DjuneGGisl08ENvPZV_lrcX4b2NCKJC1ZpXgIpxuQi4,290
3
3
  ocf_data_sampler/config/__init__.py,sha256=O29mbH0XG2gIY1g3BaveGCnpBO2SFqdu-qzJ7a6evl0,223
4
4
  ocf_data_sampler/config/load.py,sha256=LL-7wemI8o4KPkx35j-wQ3HjsMvDgqXr7G46IcASfnU,632
5
- ocf_data_sampler/config/model.py,sha256=L0-ZLeO9JHsorgbJdX4NvoFOU4lVW58DgXEgupBBuko,10533
5
+ ocf_data_sampler/config/model.py,sha256=UwVQOjRBthbwhAWR5Rcs5cSXG3imLZ5pnd8vBeFseLE,10623
6
6
  ocf_data_sampler/config/save.py,sha256=m8SPw5rXjkMm1rByjh3pK5StdBi4e8ysnn3jQopdRaI,1064
7
7
  ocf_data_sampler/data/uk_gsp_locations_20220314.csv,sha256=RSh7DRh55E3n8lVAaWXGTaXXHevZZtI58td4d4DhGos,10415772
8
8
  ocf_data_sampler/data/uk_gsp_locations_20250109.csv,sha256=XZISFatnbpO9j8LwaxNKFzQSjs6hcHFsV8a9uDDpy2E,9055334
9
9
  ocf_data_sampler/load/__init__.py,sha256=-vQP9g0UOWdVbjEGyVX_ipa7R1btmiETIKAf6aw4d78,201
10
- ocf_data_sampler/load/gsp.py,sha256=YsIlj-LBUbREHNi78JMppOM1NbSkOe4kvtIrTwDx_JQ,1888
11
- ocf_data_sampler/load/load_dataset.py,sha256=wSXPUQKgGRM6HC-yBXQ2IcDBQDckOSllmbGnhqikFMQ,2055
10
+ ocf_data_sampler/load/gsp.py,sha256=winSW3ibFbpsOr0ZRIjYUlqSW5C6SUb0dxkRZm3E8GI,2195
11
+ ocf_data_sampler/load/load_dataset.py,sha256=WjB3DvHbDQQYYnPmDFOWg_TQPgARZ5pu8fiRZSGtIg0,2099
12
12
  ocf_data_sampler/load/satellite.py,sha256=E7Ln7Y60Qr1RTV-_R71YoxXQM-Ca7Y1faIo3oKB2eFk,2292
13
13
  ocf_data_sampler/load/site.py,sha256=zOzlWk6pYZBB5daqG8URGksmDXWKrkutUvN8uALAIh8,1468
14
14
  ocf_data_sampler/load/utils.py,sha256=sZ0-zzconcLkVQwAkCYrqKDo98Hrh5ChdiQJv5Bh91g,2040
@@ -36,7 +36,7 @@ ocf_data_sampler/select/fill_time_periods.py,sha256=TlGxp1xiAqnhdWfLy0pv3FuZc00d
36
36
  ocf_data_sampler/select/find_contiguous_time_periods.py,sha256=8lkWsV5i7iLCVGqQ-PGZbvWxsz3wBvLO70GSf6WeR0k,11363
37
37
  ocf_data_sampler/select/geospatial.py,sha256=CDExkl36eZOKmdJPzUr_K0Wn3axHqv5nYo-EkSiINcc,5032
38
38
  ocf_data_sampler/select/location.py,sha256=AZvGR8y62opiW7zACGXjoOtBEWRfSLOZIA73O5Deu0c,1037
39
- ocf_data_sampler/select/select_spatial_slice.py,sha256=liAqIa-Amj58pOqx5r16i99HURj9oQ41j7gnPgRDQP4,8201
39
+ ocf_data_sampler/select/select_spatial_slice.py,sha256=Hd4jGRUfIZRoWCirOQZeoLpaUnStB6KyFSTPX69wZLw,8790
40
40
  ocf_data_sampler/select/select_time_slice.py,sha256=HeHbwZ0CP03x0-LaJtpbSdtpLufwVTR73p6wH6O_PS8,5513
41
41
  ocf_data_sampler/torch_datasets/datasets/__init__.py,sha256=jfJSFcR0eO1AqeH7S3KnGjsBqVZT5w3oyi784PUR6Q0,146
42
42
  ocf_data_sampler/torch_datasets/datasets/pvnet_uk.py,sha256=cd4IyzYu8rMFgLHRXqYpnOIAZe4Yl21YdLmDQw45F7o,12545
@@ -55,7 +55,7 @@ ocf_data_sampler/torch_datasets/utils/validation_utils.py,sha256=YqmT-lExWlI8_ul
55
55
  scripts/download_gsp_location_data.py,sha256=rRDXMoqX-RYY4jPdxhdlxJGhWdl6r245F5UARgKV6P4,3121
56
56
  scripts/refactor_site.py,sha256=skzvsPP0Cn9yTKndzkilyNcGz4DZ88ctvCJ0XrBdc2A,3135
57
57
  utils/compute_icon_mean_stddev.py,sha256=a1oWMRMnny39rV-dvu8rcx85sb4bXzPFrR1gkUr4Jpg,2296
58
- ocf_data_sampler-0.2.23.dist-info/METADATA,sha256=eQH416SngTjkM7gtOazOOZ0UA-Yluh7hHnsrZPben18,11581
59
- ocf_data_sampler-0.2.23.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
60
- ocf_data_sampler-0.2.23.dist-info/top_level.txt,sha256=LEFU4Uk-PEo72QGLAfnVZIUEm37Q8mKuMeg_Xk-p33g,31
61
- ocf_data_sampler-0.2.23.dist-info/RECORD,,
58
+ ocf_data_sampler-0.2.25.dist-info/METADATA,sha256=u6j_F7UrIXRRxT9Xj4U0ylvFCik4scyCEjeaSDmUIQ8,11581
59
+ ocf_data_sampler-0.2.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
+ ocf_data_sampler-0.2.25.dist-info/top_level.txt,sha256=LEFU4Uk-PEo72QGLAfnVZIUEm37Q8mKuMeg_Xk-p33g,31
61
+ ocf_data_sampler-0.2.25.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5