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

@@ -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
@@ -2,7 +2,7 @@ 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=y8maV_1z0LL_m0J607ka_yJ0KI-0ssYDn5Ghk8aNgR0,10189
5
+ ocf_data_sampler/config/model.py,sha256=pb02qtCmWhJhrU3_T_gUzC7i2_JcO8xGwwhKGd8yMuk,10209
6
6
  ocf_data_sampler/config/save.py,sha256=m8SPw5rXjkMm1rByjh3pK5StdBi4e8ysnn3jQopdRaI,1064
7
7
  ocf_data_sampler/data/uk_gsp_locations.csv,sha256=RSh7DRh55E3n8lVAaWXGTaXXHevZZtI58td4d4DhGos,10415772
8
8
  ocf_data_sampler/load/__init__.py,sha256=T5Zj1PGt0aiiNEN7Ra1Ac-cBsNKhphmmHy_8g7XU_w0,219
@@ -12,8 +12,9 @@ ocf_data_sampler/load/satellite.py,sha256=E7Ln7Y60Qr1RTV-_R71YoxXQM-Ca7Y1faIo3oK
12
12
  ocf_data_sampler/load/site.py,sha256=zOzlWk6pYZBB5daqG8URGksmDXWKrkutUvN8uALAIh8,1468
13
13
  ocf_data_sampler/load/utils.py,sha256=Jwbr1rpEa3cefjw-OTVRaxnIHyGixYB3TlTlta0BOdU,1727
14
14
  ocf_data_sampler/load/nwp/__init__.py,sha256=SmcrnbygO5xtCKmGR4wtHrj-HI7nOAvnAtfuvRufBGQ,25
15
- ocf_data_sampler/load/nwp/nwp.py,sha256=0AIHQTJLUtwP2Toz_PskOTYFJXfMvGhk8faAcNvI9jk,922
15
+ ocf_data_sampler/load/nwp/nwp.py,sha256=OUK6thsKfEcqGUj4WoxDiyqGcVwwoujePdmQRis8H8I,1076
16
16
  ocf_data_sampler/load/nwp/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ ocf_data_sampler/load/nwp/providers/cloudcasting.py,sha256=mGsEqo5nVGQhfIK1KC-ywLsaFKU18-UFKqQVtB8gpnw,1564
17
18
  ocf_data_sampler/load/nwp/providers/ecmwf.py,sha256=5AzktPJgertCx6oij6aePRosPuZHGFznMxTgtkk_mgc,994
18
19
  ocf_data_sampler/load/nwp/providers/gfs.py,sha256=JSDeh4YG1wibV8--P3X-zTO8LP0dsJcpFvIyglBbhi0,979
19
20
  ocf_data_sampler/load/nwp/providers/icon.py,sha256=yYUrs5HgjU0C5pMHBB6FGn3tLjswi990IY6QCXS1Zmw,1569
@@ -51,7 +52,7 @@ ocf_data_sampler/torch_datasets/utils/merge_and_fill_utils.py,sha256=we7BTxRH7B7
51
52
  ocf_data_sampler/torch_datasets/utils/valid_time_periods.py,sha256=xcy75cVxl0WrglnX5YUAFjXXlO2GwEBHWyqo8TDuiOA,4714
52
53
  scripts/refactor_site.py,sha256=skzvsPP0Cn9yTKndzkilyNcGz4DZ88ctvCJ0XrBdc2A,3135
53
54
  utils/compute_icon_mean_stddev.py,sha256=a1oWMRMnny39rV-dvu8rcx85sb4bXzPFrR1gkUr4Jpg,2296
54
- ocf_data_sampler-0.2.3.dist-info/METADATA,sha256=AHPkmaocRkmk__-A4eAPRoTlTQ7K_pqWmj0AY75i4lA,11594
55
- ocf_data_sampler-0.2.3.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
56
- ocf_data_sampler-0.2.3.dist-info/top_level.txt,sha256=LEFU4Uk-PEo72QGLAfnVZIUEm37Q8mKuMeg_Xk-p33g,31
57
- ocf_data_sampler-0.2.3.dist-info/RECORD,,
55
+ ocf_data_sampler-0.2.4.dist-info/METADATA,sha256=FC4sEcGWlkOdXRxqoiln0f-aYqXa5c9bRt7nVeNVuBI,11594
56
+ ocf_data_sampler-0.2.4.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
57
+ ocf_data_sampler-0.2.4.dist-info/top_level.txt,sha256=LEFU4Uk-PEo72QGLAfnVZIUEm37Q8mKuMeg_Xk-p33g,31
58
+ ocf_data_sampler-0.2.4.dist-info/RECORD,,