ocf-data-sampler 0.0.15__tar.gz → 0.0.17__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.

Potentially problematic release.


This version of ocf-data-sampler might be problematic. Click here for more details.

Files changed (40) hide show
  1. {ocf_data_sampler-0.0.15/ocf_data_sampler.egg-info → ocf_data_sampler-0.0.17}/PKG-INFO +3 -1
  2. ocf_data_sampler-0.0.17/README.md +4 -0
  3. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/nwp/providers/ecmwf.py +7 -2
  4. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/nwp/providers/ukv.py +6 -2
  5. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/satellite.py +6 -2
  6. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/utils.py +14 -1
  7. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17/ocf_data_sampler.egg-info}/PKG-INFO +3 -1
  8. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/setup.py +1 -1
  9. ocf_data_sampler-0.0.15/README.md +0 -2
  10. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/LICENSE +0 -0
  11. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/MANIFEST.in +0 -0
  12. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/__init__.py +0 -0
  13. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/data/uk_gsp_locations.csv +0 -0
  14. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/__init__.py +0 -0
  15. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/gsp.py +0 -0
  16. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/nwp/__init__.py +0 -0
  17. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/nwp/nwp.py +0 -0
  18. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/nwp/providers/__init__.py +0 -0
  19. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/load/nwp/providers/utils.py +0 -0
  20. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/numpy_batch/__init__.py +0 -0
  21. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/numpy_batch/gsp.py +0 -0
  22. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/numpy_batch/nwp.py +0 -0
  23. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/numpy_batch/satellite.py +0 -0
  24. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/numpy_batch/sun_position.py +0 -0
  25. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/select/__init__.py +0 -0
  26. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/select/dropout.py +0 -0
  27. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/select/fill_time_periods.py +0 -0
  28. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/select/find_contiguous_time_periods.py +0 -0
  29. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/select/select_spatial_slice.py +0 -0
  30. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/select/select_time_slice.py +0 -0
  31. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/torch_datasets/__init__.py +0 -0
  32. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler/torch_datasets/pvnet_uk_regional.py +0 -0
  33. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler.egg-info/SOURCES.txt +0 -0
  34. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler.egg-info/dependency_links.txt +0 -0
  35. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler.egg-info/requires.txt +0 -0
  36. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/ocf_data_sampler.egg-info/top_level.txt +0 -0
  37. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/requirements.txt +0 -0
  38. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/setup.cfg +0 -0
  39. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/tests/__init__.py +0 -0
  40. {ocf_data_sampler-0.0.15 → ocf_data_sampler-0.0.17}/tests/conftest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ocf_data_sampler
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Sample from weather data for renewable energy prediction
5
5
  Author: James Fulton, Peter Dudfield, and the Open Climate Fix team
6
6
  Author-email: info@openclimatefix.org
@@ -17,4 +17,6 @@ Requires-Dist: ocf_datapipes==3.3.39
17
17
  Requires-Dist: pvlib
18
18
 
19
19
  # OCF Data Sampler
20
+ [![ease of contribution: easy](https://img.shields.io/badge/ease%20of%20contribution:%20easy-32bd50)](https://github.com/openclimatefix/ocf-meta-repo?tab=readme-ov-file#overview-of-ocfs-nowcasting-repositories)
21
+
20
22
  A repo for sampling from weather data for renewable energy prediction
@@ -0,0 +1,4 @@
1
+ # OCF Data Sampler
2
+ [![ease of contribution: easy](https://img.shields.io/badge/ease%20of%20contribution:%20easy-32bd50)](https://github.com/openclimatefix/ocf-meta-repo?tab=readme-ov-file#overview-of-ocfs-nowcasting-repositories)
3
+
4
+ A repo for sampling from weather data for renewable energy prediction
@@ -2,7 +2,12 @@
2
2
  from pathlib import Path
3
3
  import xarray as xr
4
4
  from ocf_data_sampler.load.nwp.providers.utils import open_zarr_paths
5
- from ocf_data_sampler.load.utils import check_time_unique_increasing, make_spatial_coords_increasing
5
+ from ocf_data_sampler.load.utils import (
6
+ check_time_unique_increasing,
7
+ make_spatial_coords_increasing,
8
+ get_xr_data_array_from_xr_dataset
9
+ )
10
+
6
11
 
7
12
 
8
13
  def open_ifs(zarr_path: Path | str | list[Path] | list[str]) -> xr.DataArray:
@@ -35,4 +40,4 @@ def open_ifs(zarr_path: Path | str | list[Path] | list[str]) -> xr.DataArray:
35
40
  ds = ds.transpose("init_time_utc", "step", "channel", "longitude", "latitude")
36
41
 
37
42
  # TODO: should we control the dtype of the DataArray?
38
- return ds.ECMWF_UK
43
+ return get_xr_data_array_from_xr_dataset(ds)
@@ -5,7 +5,11 @@ import xarray as xr
5
5
  from pathlib import Path
6
6
 
7
7
  from ocf_data_sampler.load.nwp.providers.utils import open_zarr_paths
8
- from ocf_data_sampler.load.utils import check_time_unique_increasing, make_spatial_coords_increasing
8
+ from ocf_data_sampler.load.utils import (
9
+ check_time_unique_increasing,
10
+ make_spatial_coords_increasing,
11
+ get_xr_data_array_from_xr_dataset
12
+ )
9
13
 
10
14
 
11
15
  def open_ukv(zarr_path: Path | str | list[Path] | list[str]) -> xr.DataArray:
@@ -40,6 +44,6 @@ def open_ukv(zarr_path: Path | str | list[Path] | list[str]) -> xr.DataArray:
40
44
  ds = ds.transpose("init_time_utc", "step", "channel", "x_osgb", "y_osgb")
41
45
 
42
46
  # TODO: should we control the dtype of the DataArray?
43
- return ds.UKV
47
+ return get_xr_data_array_from_xr_dataset(ds)
44
48
 
45
49
 
@@ -4,7 +4,11 @@ import subprocess
4
4
  from pathlib import Path
5
5
 
6
6
  import xarray as xr
7
- from ocf_data_sampler.load.utils import check_time_unique_increasing, make_spatial_coords_increasing
7
+ from ocf_data_sampler.load.utils import (
8
+ check_time_unique_increasing,
9
+ make_spatial_coords_increasing,
10
+ get_xr_data_array_from_xr_dataset
11
+ )
8
12
 
9
13
 
10
14
  def _get_single_sat_data(zarr_path: Path | str) -> xr.Dataset:
@@ -97,4 +101,4 @@ def open_sat_data(zarr_path: Path | str | list[Path] | list[str]) -> xr.DataArra
97
101
  ds = ds.transpose("time_utc", "channel", "x_geostationary", "y_geostationary")
98
102
 
99
103
  # TODO: should we control the dtype of the DataArray?
100
- return ds.data
104
+ return get_xr_data_array_from_xr_dataset(ds)
@@ -27,4 +27,17 @@ def make_spatial_coords_increasing(ds: xr.Dataset, x_coord: str, y_coord: str) -
27
27
  assert (ds[x_coord].diff(dim=x_coord) > 0).all()
28
28
  assert (ds[y_coord].diff(dim=y_coord) > 0).all()
29
29
 
30
- return ds
30
+ return ds
31
+
32
+
33
+ def get_xr_data_array_from_xr_dataset(ds: xr.Dataset) -> xr.DataArray:
34
+ """Return underlying xr.DataArray from passed xr.Dataset.
35
+ Checks only one variable is present and returns it as an xr.DataArray.
36
+
37
+ Args:
38
+ ds: xr.Dataset to extract xr.DataArray from
39
+ """
40
+
41
+ datavars = list(ds.var())
42
+ assert len(datavars) == 1, "Cannot open as xr.DataArray: dataset contains multiple variables"
43
+ return ds[datavars[0]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ocf_data_sampler
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Sample from weather data for renewable energy prediction
5
5
  Author: James Fulton, Peter Dudfield, and the Open Climate Fix team
6
6
  Author-email: info@openclimatefix.org
@@ -17,4 +17,6 @@ Requires-Dist: ocf_datapipes==3.3.39
17
17
  Requires-Dist: pvlib
18
18
 
19
19
  # OCF Data Sampler
20
+ [![ease of contribution: easy](https://img.shields.io/badge/ease%20of%20contribution:%20easy-32bd50)](https://github.com/openclimatefix/ocf-meta-repo?tab=readme-ov-file#overview-of-ocfs-nowcasting-repositories)
21
+
20
22
  A repo for sampling from weather data for renewable energy prediction
@@ -10,7 +10,7 @@ install_requires = (this_directory / "requirements.txt").read_text().splitlines(
10
10
 
11
11
  setup(
12
12
  name="ocf_data_sampler",
13
- version="0.0.15",
13
+ version="0.0.17",
14
14
  license="MIT",
15
15
  description="Sample from weather data for renewable energy prediction",
16
16
  author="James Fulton, Peter Dudfield, and the Open Climate Fix team",
@@ -1,2 +0,0 @@
1
- # OCF Data Sampler
2
- A repo for sampling from weather data for renewable energy prediction