ocf-data-sampler 0.0.15__py3-none-any.whl → 0.0.16__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/nwp/providers/ecmwf.py +7 -2
- ocf_data_sampler/load/nwp/providers/ukv.py +6 -2
- ocf_data_sampler/load/satellite.py +6 -2
- ocf_data_sampler/load/utils.py +14 -1
- {ocf_data_sampler-0.0.15.dist-info → ocf_data_sampler-0.0.16.dist-info}/METADATA +1 -1
- {ocf_data_sampler-0.0.15.dist-info → ocf_data_sampler-0.0.16.dist-info}/RECORD +9 -9
- {ocf_data_sampler-0.0.15.dist-info → ocf_data_sampler-0.0.16.dist-info}/LICENSE +0 -0
- {ocf_data_sampler-0.0.15.dist-info → ocf_data_sampler-0.0.16.dist-info}/WHEEL +0 -0
- {ocf_data_sampler-0.0.15.dist-info → ocf_data_sampler-0.0.16.dist-info}/top_level.txt +0 -0
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
104
|
+
return get_xr_data_array_from_xr_dataset(ds)
|
ocf_data_sampler/load/utils.py
CHANGED
|
@@ -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]]
|
|
@@ -2,13 +2,13 @@ ocf_data_sampler/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,
|
|
|
2
2
|
ocf_data_sampler/data/uk_gsp_locations.csv,sha256=RSh7DRh55E3n8lVAaWXGTaXXHevZZtI58td4d4DhGos,10415772
|
|
3
3
|
ocf_data_sampler/load/__init__.py,sha256=MjgfxilTzyz1RYFoBEeAXmE9hyjknLvdmlHPmlAoiQY,44
|
|
4
4
|
ocf_data_sampler/load/gsp.py,sha256=Gcr1JVUOPKhFRDCSHtfPDjxx0BtyyEhXrZvGEKLPJ5I,759
|
|
5
|
-
ocf_data_sampler/load/satellite.py,sha256=
|
|
6
|
-
ocf_data_sampler/load/utils.py,sha256=
|
|
5
|
+
ocf_data_sampler/load/satellite.py,sha256=3KlA1fx4SwxdzM-jC1WRaONXO0D6m0WxORnEnwUnZrA,2967
|
|
6
|
+
ocf_data_sampler/load/utils.py,sha256=EQGvVWlGMoSOdbDYuMfVAa0v6wmAOPmHIAemdrTB5v4,1406
|
|
7
7
|
ocf_data_sampler/load/nwp/__init__.py,sha256=SmcrnbygO5xtCKmGR4wtHrj-HI7nOAvnAtfuvRufBGQ,25
|
|
8
8
|
ocf_data_sampler/load/nwp/nwp.py,sha256=O4QnajEZem8BvBgTcYYDBhRhgqPYuJkolHmpMRmrXEA,610
|
|
9
9
|
ocf_data_sampler/load/nwp/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
ocf_data_sampler/load/nwp/providers/ecmwf.py,sha256=
|
|
11
|
-
ocf_data_sampler/load/nwp/providers/ukv.py,sha256=
|
|
10
|
+
ocf_data_sampler/load/nwp/providers/ecmwf.py,sha256=vW-p3vCyQ-CofKo555-gE7VDi5hlpjtjTLfHqWF0HEE,1175
|
|
11
|
+
ocf_data_sampler/load/nwp/providers/ukv.py,sha256=79Bm7q-K_GJPYMy62SUIZbRWRF4-tIaB1dYPEgLD9vo,1207
|
|
12
12
|
ocf_data_sampler/load/nwp/providers/utils.py,sha256=Sy2exG1wpXLLhMXYdsfR-DZMR3txG1_bBmBdchlc-yA,848
|
|
13
13
|
ocf_data_sampler/numpy_batch/__init__.py,sha256=mrtqwbGik5Zc9MYP5byfCTBm08wMtS2XnTsypC4fPMo,245
|
|
14
14
|
ocf_data_sampler/numpy_batch/gsp.py,sha256=EL0_cJJNyvkQQcOat9vFA61pF4lema3BP_vB4ZS788U,805
|
|
@@ -25,8 +25,8 @@ ocf_data_sampler/torch_datasets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOC
|
|
|
25
25
|
ocf_data_sampler/torch_datasets/pvnet_uk_regional.py,sha256=haljV4FAZI4-Qf-65nq-JIJOIQNhR6YRncjTBWMYkY4,18502
|
|
26
26
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
tests/conftest.py,sha256=OcArgF60paroZQqoP7xExRBF34nEyMuXd7dS7hD6p3w,5393
|
|
28
|
-
ocf_data_sampler-0.0.
|
|
29
|
-
ocf_data_sampler-0.0.
|
|
30
|
-
ocf_data_sampler-0.0.
|
|
31
|
-
ocf_data_sampler-0.0.
|
|
32
|
-
ocf_data_sampler-0.0.
|
|
28
|
+
ocf_data_sampler-0.0.16.dist-info/LICENSE,sha256=F-Q3UFCR-BECSocV55BFDpn4YKxve9PKrm-lTt6o_Tg,1073
|
|
29
|
+
ocf_data_sampler-0.0.16.dist-info/METADATA,sha256=lV0PmJljbd63TmlSErEOXN8zSn5031q4WHItd5mJGs4,588
|
|
30
|
+
ocf_data_sampler-0.0.16.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
31
|
+
ocf_data_sampler-0.0.16.dist-info/top_level.txt,sha256=KaQn5qzkJGJP6hKWqsVAc9t0cMLjVvSTk8-kTrW79SA,23
|
|
32
|
+
ocf_data_sampler-0.0.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|