ocf-data-sampler 0.2.3__tar.gz → 0.2.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.

Potentially problematic release.


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

Files changed (64) hide show
  1. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/PKG-INFO +1 -1
  2. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/config/model.py +1 -0
  3. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/nwp.py +3 -0
  4. ocf_data_sampler-0.2.4/ocf_data_sampler/load/nwp/providers/cloudcasting.py +51 -0
  5. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler.egg-info/PKG-INFO +1 -1
  6. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler.egg-info/SOURCES.txt +1 -0
  7. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/LICENSE +0 -0
  8. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/README.md +0 -0
  9. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/__init__.py +0 -0
  10. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/config/__init__.py +0 -0
  11. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/config/load.py +0 -0
  12. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/config/save.py +0 -0
  13. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/data/uk_gsp_locations.csv +0 -0
  14. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/__init__.py +0 -0
  15. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/gsp.py +0 -0
  16. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/load_dataset.py +0 -0
  17. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/__init__.py +0 -0
  18. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/providers/__init__.py +0 -0
  19. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/providers/ecmwf.py +0 -0
  20. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/providers/gfs.py +0 -0
  21. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/providers/icon.py +0 -0
  22. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/providers/ukv.py +0 -0
  23. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/nwp/providers/utils.py +0 -0
  24. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/satellite.py +0 -0
  25. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/site.py +0 -0
  26. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/load/utils.py +0 -0
  27. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/__init__.py +0 -0
  28. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/collate.py +0 -0
  29. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/common_types.py +0 -0
  30. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/datetime_features.py +0 -0
  31. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/gsp.py +0 -0
  32. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/nwp.py +0 -0
  33. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/satellite.py +0 -0
  34. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/site.py +0 -0
  35. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/numpy_sample/sun_position.py +0 -0
  36. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/sample/__init__.py +0 -0
  37. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/sample/base.py +0 -0
  38. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/sample/site.py +0 -0
  39. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/sample/uk_regional.py +0 -0
  40. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/__init__.py +0 -0
  41. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/dropout.py +0 -0
  42. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/fill_time_periods.py +0 -0
  43. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/find_contiguous_time_periods.py +0 -0
  44. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/geospatial.py +0 -0
  45. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/location.py +0 -0
  46. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/select_spatial_slice.py +0 -0
  47. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/select_time_slice.py +0 -0
  48. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/spatial_slice_for_dataset.py +0 -0
  49. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/select/time_slice_for_dataset.py +0 -0
  50. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/datasets/__init__.py +0 -0
  51. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/datasets/pvnet_uk.py +0 -0
  52. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/datasets/site.py +0 -0
  53. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/utils/__init__.py +0 -0
  54. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/utils/channel_dict_to_dataarray.py +0 -0
  55. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/utils/merge_and_fill_utils.py +0 -0
  56. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/torch_datasets/utils/valid_time_periods.py +0 -0
  57. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler/utils.py +0 -0
  58. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler.egg-info/dependency_links.txt +0 -0
  59. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler.egg-info/requires.txt +0 -0
  60. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/ocf_data_sampler.egg-info/top_level.txt +0 -0
  61. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/pyproject.toml +0 -0
  62. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/scripts/refactor_site.py +0 -0
  63. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/setup.cfg +0 -0
  64. {ocf_data_sampler-0.2.3 → ocf_data_sampler-0.2.4}/utils/compute_icon_mean_stddev.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ocf-data-sampler
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Author: James Fulton, Peter Dudfield
5
5
  Author-email: Open Climate Fix team <info@openclimatefix.org>
6
6
  License: MIT License
@@ -14,6 +14,7 @@ NWP_PROVIDERS = [
14
14
  "ecmwf",
15
15
  "gfs",
16
16
  "icon_eu",
17
+ "cloudcasting",
17
18
  ]
18
19
 
19
20
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  import xarray as xr
4
4
 
5
+ from ocf_data_sampler.load.nwp.providers.cloudcasting import open_cloudcasting
5
6
  from ocf_data_sampler.load.nwp.providers.ecmwf import open_ifs
6
7
  from ocf_data_sampler.load.nwp.providers.gfs import open_gfs
7
8
  from ocf_data_sampler.load.nwp.providers.icon import open_icon_eu
@@ -28,6 +29,8 @@ def open_nwp(zarr_path: str | list[str], provider: str) -> xr.DataArray:
28
29
  _open_nwp = open_icon_eu
29
30
  elif provider == "gfs":
30
31
  _open_nwp = open_gfs
32
+ elif provider == "cloudcasting":
33
+ _open_nwp = open_cloudcasting
31
34
  else:
32
35
  raise ValueError(f"Unknown provider: {provider}")
33
36
 
@@ -0,0 +1,51 @@
1
+ """Cloudcasting provider loader."""
2
+
3
+ from pathlib import Path
4
+
5
+ import xarray as xr
6
+
7
+ from ocf_data_sampler.load.nwp.providers.utils import open_zarr_paths
8
+ from ocf_data_sampler.load.utils import (
9
+ check_time_unique_increasing,
10
+ get_xr_data_array_from_xr_dataset,
11
+ make_spatial_coords_increasing,
12
+ )
13
+
14
+
15
+ def open_cloudcasting(zarr_path: Path | str | list[Path] | list[str]) -> xr.DataArray:
16
+ """Opens the satellite predictions from cloudcasting.
17
+
18
+ Cloudcasting is a OCF forecast product. We forecast future satellite images from recent
19
+ satellite images. More information can be found in the references below.
20
+
21
+ Args:
22
+ zarr_path: Path to the zarr to open
23
+
24
+ Returns:
25
+ Xarray DataArray of the cloudcasting data
26
+
27
+ References:
28
+ [1] https://www.openclimatefix.org/projects/cloud-forecasting
29
+ [2] https://github.com/ClimeTrend/cloudcasting
30
+ [3] https://github.com/openclimatefix/sat_pred
31
+ """
32
+ # Open the data
33
+ ds = open_zarr_paths(zarr_path)
34
+
35
+ # Rename
36
+ ds = ds.rename(
37
+ {
38
+ "init_time": "init_time_utc",
39
+ "variable": "channel",
40
+ },
41
+ )
42
+
43
+ # Check the timestamps are unique and increasing
44
+ check_time_unique_increasing(ds.init_time_utc)
45
+
46
+ # Make sure the spatial coords are in increasing order
47
+ ds = make_spatial_coords_increasing(ds, x_coord="x_geostationary", y_coord="y_geostationary")
48
+
49
+ ds = ds.transpose("init_time_utc", "step", "channel", "x_geostationary", "y_geostationary")
50
+
51
+ return get_xr_data_array_from_xr_dataset(ds)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ocf-data-sampler
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Author: James Fulton, Peter Dudfield
5
5
  Author-email: Open Climate Fix team <info@openclimatefix.org>
6
6
  License: MIT License
@@ -22,6 +22,7 @@ ocf_data_sampler/load/utils.py
22
22
  ocf_data_sampler/load/nwp/__init__.py
23
23
  ocf_data_sampler/load/nwp/nwp.py
24
24
  ocf_data_sampler/load/nwp/providers/__init__.py
25
+ ocf_data_sampler/load/nwp/providers/cloudcasting.py
25
26
  ocf_data_sampler/load/nwp/providers/ecmwf.py
26
27
  ocf_data_sampler/load/nwp/providers/gfs.py
27
28
  ocf_data_sampler/load/nwp/providers/icon.py