ocf-data-sampler 0.0.23__tar.gz → 0.0.24__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.
- {ocf_data_sampler-0.0.23/ocf_data_sampler.egg-info → ocf_data_sampler-0.0.24}/PKG-INFO +1 -1
- ocf_data_sampler-0.0.24/ocf_data_sampler/numpy_batch/__init__.py +7 -0
- ocf_data_sampler-0.0.24/ocf_data_sampler/numpy_batch/gsp.py +33 -0
- ocf_data_sampler-0.0.24/ocf_data_sampler/numpy_batch/nwp.py +43 -0
- ocf_data_sampler-0.0.24/ocf_data_sampler/numpy_batch/satellite.py +30 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/torch_datasets/pvnet_uk_regional.py +4 -4
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24/ocf_data_sampler.egg-info}/PKG-INFO +1 -1
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/pyproject.toml +1 -1
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/numpy_batch/test_gsp.py +1 -2
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/numpy_batch/test_nwp.py +1 -3
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/numpy_batch/test_satellite.py +1 -3
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/numpy_batch/test_sun_position.py +7 -7
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/torch_datasets/test_pvnet_uk_regional.py +4 -6
- ocf_data_sampler-0.0.23/ocf_data_sampler/numpy_batch/__init__.py +0 -7
- ocf_data_sampler-0.0.23/ocf_data_sampler/numpy_batch/gsp.py +0 -33
- ocf_data_sampler-0.0.23/ocf_data_sampler/numpy_batch/nwp.py +0 -43
- ocf_data_sampler-0.0.23/ocf_data_sampler/numpy_batch/satellite.py +0 -30
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/LICENSE +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/MANIFEST.in +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/README.md +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/config/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/config/load.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/config/model.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/config/save.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/constants.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/data/uk_gsp_locations.csv +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/gsp.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/nwp.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/ecmwf.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/ukv.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/utils.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/satellite.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/utils.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/numpy_batch/sun_position.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/dropout.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/fill_time_periods.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/find_contiguous_time_periods.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/geospatial.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/location.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/select_spatial_slice.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/select_time_slice.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/torch_datasets/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler.egg-info/SOURCES.txt +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler.egg-info/dependency_links.txt +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler.egg-info/requires.txt +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler.egg-info/top_level.txt +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/setup.cfg +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/__init__.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/config/test_config.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/conftest.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/load/test_load_gsp.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/load/test_load_nwp.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/load/test_load_satellite.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_dropout.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_fill_time_periods.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_find_contiguous_time_periods.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_location.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_select_spatial_slice.py +0 -0
- {ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_select_time_slice.py +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Conversion from Xarray to NumpyBatch"""
|
|
2
|
+
|
|
3
|
+
from .gsp import convert_gsp_to_numpy_batch, GSPBatchKey
|
|
4
|
+
from .nwp import convert_nwp_to_numpy_batch, NWPBatchKey
|
|
5
|
+
from .satellite import convert_satellite_to_numpy_batch, SatelliteBatchKey
|
|
6
|
+
from .sun_position import make_sun_position_numpy_batch
|
|
7
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Convert GSP to Numpy Batch"""
|
|
2
|
+
|
|
3
|
+
import xarray as xr
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class GSPBatchKey:
|
|
7
|
+
|
|
8
|
+
gsp = 'gsp'
|
|
9
|
+
nominal_capacity_mwp = 'gsp_nominal_capacity_mwp'
|
|
10
|
+
effective_capacity_mwp = 'gsp_effective_capacity_mwp'
|
|
11
|
+
time_utc = 'gsp_time_utc'
|
|
12
|
+
t0_idx = 'gsp_t0_idx'
|
|
13
|
+
solar_azimuth = 'gsp_solar_azimuth'
|
|
14
|
+
solar_elevation = 'gsp_solar_elevation'
|
|
15
|
+
gsp_id = 'gsp_id'
|
|
16
|
+
x_osgb = 'gsp_x_osgb'
|
|
17
|
+
y_osgb = 'gsp_y_osgb'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def convert_gsp_to_numpy_batch(da: xr.DataArray, t0_idx: int | None = None) -> dict:
|
|
21
|
+
"""Convert from Xarray to NumpyBatch"""
|
|
22
|
+
|
|
23
|
+
example = {
|
|
24
|
+
GSPBatchKey.gsp: da.values,
|
|
25
|
+
GSPBatchKey.nominal_capacity_mwp: da.isel(time_utc=0)["nominal_capacity_mwp"].values,
|
|
26
|
+
GSPBatchKey.effective_capacity_mwp: da.isel(time_utc=0)["effective_capacity_mwp"].values,
|
|
27
|
+
GSPBatchKey.time_utc: da["time_utc"].values.astype(float),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if t0_idx is not None:
|
|
31
|
+
example[GSPBatchKey.t0_idx] = t0_idx
|
|
32
|
+
|
|
33
|
+
return example
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Convert NWP to NumpyBatch"""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import xarray as xr
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NWPBatchKey:
|
|
8
|
+
|
|
9
|
+
nwp = 'nwp'
|
|
10
|
+
channel_names = 'nwp_channel_names'
|
|
11
|
+
init_time_utc = 'nwp_init_time_utc'
|
|
12
|
+
step = 'nwp_step'
|
|
13
|
+
target_time_utc = 'nwp_target_time_utc'
|
|
14
|
+
t0_idx = 'nwp_t0_idx'
|
|
15
|
+
y_osgb = 'nwp_y_osgb'
|
|
16
|
+
x_osgb = 'nwp_x_osgb'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def convert_nwp_to_numpy_batch(da: xr.DataArray, t0_idx: int | None = None) -> dict:
|
|
20
|
+
"""Convert from Xarray to NWP NumpyBatch"""
|
|
21
|
+
|
|
22
|
+
example = {
|
|
23
|
+
NWPBatchKey.nwp: da.values,
|
|
24
|
+
NWPBatchKey.channel_names: da.channel.values,
|
|
25
|
+
NWPBatchKey.init_time_utc: da.init_time_utc.values.astype(float),
|
|
26
|
+
NWPBatchKey.step: (da.step.values / pd.Timedelta("1h")).astype(int),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if "target_time_utc" in da.coords:
|
|
30
|
+
example[NWPBatchKey.target_time_utc] = da.target_time_utc.values.astype(float)
|
|
31
|
+
|
|
32
|
+
# TODO: Do we need this at all? Especially since it is only present in UKV data
|
|
33
|
+
for batch_key, dataset_key in (
|
|
34
|
+
(NWPBatchKey.y_osgb, "y_osgb"),
|
|
35
|
+
(NWPBatchKey.x_osgb, "x_osgb"),
|
|
36
|
+
):
|
|
37
|
+
if dataset_key in da.coords:
|
|
38
|
+
example[batch_key] = da[dataset_key].values
|
|
39
|
+
|
|
40
|
+
if t0_idx is not None:
|
|
41
|
+
example[NWPBatchKey.t0_idx] = t0_idx
|
|
42
|
+
|
|
43
|
+
return example
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Convert Satellite to NumpyBatch"""
|
|
2
|
+
import xarray as xr
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class SatelliteBatchKey:
|
|
6
|
+
|
|
7
|
+
satellite_actual = 'satellite_actual'
|
|
8
|
+
time_utc = 'satellite_time_utc'
|
|
9
|
+
x_geostationary = 'satellite_x_geostationary'
|
|
10
|
+
y_geostationary = 'satellite_y_geostationary'
|
|
11
|
+
t0_idx = 'satellite_t0_idx'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def convert_satellite_to_numpy_batch(da: xr.DataArray, t0_idx: int | None = None) -> dict:
|
|
15
|
+
"""Convert from Xarray to NumpyBatch"""
|
|
16
|
+
example = {
|
|
17
|
+
SatelliteBatchKey.satellite_actual: da.values,
|
|
18
|
+
SatelliteBatchKey.time_utc: da.time_utc.values.astype(float),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
for batch_key, dataset_key in (
|
|
22
|
+
(SatelliteBatchKey.x_geostationary, "x_geostationary"),
|
|
23
|
+
(SatelliteBatchKey.y_geostationary, "y_geostationary"),
|
|
24
|
+
):
|
|
25
|
+
example[batch_key] = da[dataset_key].values
|
|
26
|
+
|
|
27
|
+
if t0_idx is not None:
|
|
28
|
+
example[SatelliteBatchKey.t0_idx] = t0_idx
|
|
29
|
+
|
|
30
|
+
return example
|
|
@@ -24,12 +24,12 @@ from ocf_data_sampler.numpy_batch import (
|
|
|
24
24
|
convert_nwp_to_numpy_batch,
|
|
25
25
|
convert_satellite_to_numpy_batch,
|
|
26
26
|
make_sun_position_numpy_batch,
|
|
27
|
+
NWPBatchKey,
|
|
28
|
+
GSPBatchKey,
|
|
27
29
|
)
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
from ocf_data_sampler.config import Configuration, load_yaml_configuration
|
|
31
|
-
from ocf_data_sampler.numpy_batch.nwp import NWPBatchKey
|
|
32
|
-
from ocf_data_sampler.numpy_batch.gsp import GSPBatchKey
|
|
33
33
|
|
|
34
34
|
from ocf_data_sampler.select.location import Location
|
|
35
35
|
from ocf_data_sampler.select.geospatial import osgb_to_lon_lat
|
|
@@ -426,8 +426,8 @@ def process_and_combine_datasets(
|
|
|
426
426
|
# TODO: Do we need all of these?
|
|
427
427
|
numpy_modalities.append({
|
|
428
428
|
GSPBatchKey.gsp_id: location.id,
|
|
429
|
-
GSPBatchKey.
|
|
430
|
-
GSPBatchKey.
|
|
429
|
+
GSPBatchKey.x_osgb: location.x,
|
|
430
|
+
GSPBatchKey.y_osgb: location.y,
|
|
431
431
|
})
|
|
432
432
|
|
|
433
433
|
# Combine all the modalities and fill NaNs
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from ocf_data_sampler.load.gsp import open_gsp
|
|
2
2
|
|
|
3
|
-
from ocf_data_sampler.numpy_batch import convert_gsp_to_numpy_batch
|
|
4
|
-
from ocf_data_sampler.numpy_batch.gsp import GSPBatchKey
|
|
3
|
+
from ocf_data_sampler.numpy_batch import convert_gsp_to_numpy_batch, GSPBatchKey
|
|
5
4
|
|
|
6
5
|
def test_convert_gsp_to_numpy_batch(uk_gsp_zarr_path):
|
|
7
6
|
|
|
@@ -4,9 +4,7 @@ import xarray as xr
|
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
|
-
from ocf_data_sampler.numpy_batch import convert_nwp_to_numpy_batch
|
|
8
|
-
|
|
9
|
-
from ocf_data_sampler.numpy_batch.nwp import NWPBatchKey
|
|
7
|
+
from ocf_data_sampler.numpy_batch import convert_nwp_to_numpy_batch, NWPBatchKey
|
|
10
8
|
|
|
11
9
|
@pytest.fixture(scope="module")
|
|
12
10
|
def da_nwp_like():
|
|
@@ -5,9 +5,7 @@ import xarray as xr
|
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
|
|
8
|
-
from ocf_data_sampler.numpy_batch import convert_satellite_to_numpy_batch
|
|
9
|
-
|
|
10
|
-
from ocf_data_sampler.numpy_batch.satellite import SatelliteBatchKey
|
|
8
|
+
from ocf_data_sampler.numpy_batch import convert_satellite_to_numpy_batch, SatelliteBatchKey
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
@pytest.fixture(scope="module")
|
|
@@ -6,7 +6,7 @@ from ocf_data_sampler.numpy_batch.sun_position import (
|
|
|
6
6
|
calculate_azimuth_and_elevation, make_sun_position_numpy_batch
|
|
7
7
|
)
|
|
8
8
|
|
|
9
|
-
from ocf_data_sampler.numpy_batch
|
|
9
|
+
from ocf_data_sampler.numpy_batch import GSPBatchKey
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@pytest.mark.parametrize("lat", [0, 5, 10, 23.5])
|
|
@@ -71,11 +71,11 @@ def test_make_sun_position_numpy_batch():
|
|
|
71
71
|
|
|
72
72
|
batch = make_sun_position_numpy_batch(datetimes, lon, lat, key_prefix="gsp")
|
|
73
73
|
|
|
74
|
-
assert GSPBatchKey.
|
|
75
|
-
assert GSPBatchKey.
|
|
74
|
+
assert GSPBatchKey.solar_elevation in batch
|
|
75
|
+
assert GSPBatchKey.solar_azimuth in batch
|
|
76
76
|
|
|
77
77
|
# The solar coords are normalised in the function
|
|
78
|
-
assert (batch[GSPBatchKey.
|
|
79
|
-
assert (batch[GSPBatchKey.
|
|
80
|
-
assert (batch[GSPBatchKey.
|
|
81
|
-
assert (batch[GSPBatchKey.
|
|
78
|
+
assert (batch[GSPBatchKey.solar_elevation]>=0).all()
|
|
79
|
+
assert (batch[GSPBatchKey.solar_elevation]<=1).all()
|
|
80
|
+
assert (batch[GSPBatchKey.solar_azimuth]>=0).all()
|
|
81
|
+
assert (batch[GSPBatchKey.solar_azimuth]<=1).all()
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/torch_datasets/test_pvnet_uk_regional.py
RENAMED
|
@@ -3,9 +3,7 @@ import tempfile
|
|
|
3
3
|
|
|
4
4
|
from ocf_data_sampler.torch_datasets.pvnet_uk_regional import PVNetUKRegionalDataset
|
|
5
5
|
from ocf_data_sampler.config import load_yaml_configuration, save_yaml_configuration
|
|
6
|
-
from ocf_data_sampler.numpy_batch
|
|
7
|
-
from ocf_data_sampler.numpy_batch.gsp import GSPBatchKey
|
|
8
|
-
from ocf_data_sampler.numpy_batch.satellite import SatelliteBatchKey
|
|
6
|
+
from ocf_data_sampler.numpy_batch import NWPBatchKey, GSPBatchKey, SatelliteBatchKey
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
@pytest.fixture()
|
|
@@ -39,7 +37,7 @@ def test_pvnet(pvnet_config_filename):
|
|
|
39
37
|
|
|
40
38
|
for key in [
|
|
41
39
|
NWPBatchKey.nwp, SatelliteBatchKey.satellite_actual, GSPBatchKey.gsp,
|
|
42
|
-
GSPBatchKey.
|
|
40
|
+
GSPBatchKey.solar_azimuth, GSPBatchKey.solar_elevation,
|
|
43
41
|
]:
|
|
44
42
|
assert key in sample
|
|
45
43
|
|
|
@@ -54,8 +52,8 @@ def test_pvnet(pvnet_config_filename):
|
|
|
54
52
|
# 3 hours of 30 minute data (inclusive)
|
|
55
53
|
assert sample[GSPBatchKey.gsp].shape == (7,)
|
|
56
54
|
# Solar angles have same shape as GSP data
|
|
57
|
-
assert sample[GSPBatchKey.
|
|
58
|
-
assert sample[GSPBatchKey.
|
|
55
|
+
assert sample[GSPBatchKey.solar_azimuth].shape == (7,)
|
|
56
|
+
assert sample[GSPBatchKey.solar_elevation].shape == (7,)
|
|
59
57
|
|
|
60
58
|
def test_pvnet_no_gsp(pvnet_config_filename):
|
|
61
59
|
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"""Convert GSP to Numpy Batch"""
|
|
2
|
-
|
|
3
|
-
import xarray as xr
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class GSPBatchKey:
|
|
7
|
-
|
|
8
|
-
gsp = 'gsp'
|
|
9
|
-
gsp_nominal_capacity_mwp = 'gsp_nominal_capacity_mwp'
|
|
10
|
-
gsp_effective_capacity_mwp = 'gsp_effective_capacity_mwp'
|
|
11
|
-
gsp_time_utc = 'gsp_time_utc'
|
|
12
|
-
gsp_t0_idx = 'gsp_t0_idx'
|
|
13
|
-
gsp_solar_azimuth = 'gsp_solar_azimuth'
|
|
14
|
-
gsp_solar_elevation = 'gsp_solar_elevation'
|
|
15
|
-
gsp_id = 'gsp_id'
|
|
16
|
-
gsp_x_osgb = 'gsp_x_osgb'
|
|
17
|
-
gsp_y_osgb = 'gsp_y_osgb'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def convert_gsp_to_numpy_batch(da: xr.DataArray, t0_idx: int | None = None) -> dict:
|
|
21
|
-
"""Convert from Xarray to NumpyBatch"""
|
|
22
|
-
|
|
23
|
-
example = {
|
|
24
|
-
GSPBatchKey.gsp: da.values,
|
|
25
|
-
GSPBatchKey.gsp_nominal_capacity_mwp: da.isel(time_utc=0)["nominal_capacity_mwp"].values,
|
|
26
|
-
GSPBatchKey.gsp_effective_capacity_mwp: da.isel(time_utc=0)["effective_capacity_mwp"].values,
|
|
27
|
-
GSPBatchKey.gsp_time_utc: da["time_utc"].values.astype(float),
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if t0_idx is not None:
|
|
31
|
-
example[GSPBatchKey.gsp_t0_idx] = t0_idx
|
|
32
|
-
|
|
33
|
-
return example
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"""Convert NWP to NumpyBatch"""
|
|
2
|
-
|
|
3
|
-
import pandas as pd
|
|
4
|
-
import xarray as xr
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class NWPBatchKey:
|
|
8
|
-
|
|
9
|
-
nwp = 'nwp'
|
|
10
|
-
nwp_channel_names = 'nwp_channel_names'
|
|
11
|
-
nwp_init_time_utc = 'nwp_init_time_utc'
|
|
12
|
-
nwp_step = 'nwp_step'
|
|
13
|
-
nwp_target_time_utc = 'nwp_target_time_utc'
|
|
14
|
-
nwp_t0_idx = 'nwp_t0_idx'
|
|
15
|
-
nwp_y_osgb = 'nwp_y_osgb'
|
|
16
|
-
nwp_x_osgb = 'nwp_x_osgb'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def convert_nwp_to_numpy_batch(da: xr.DataArray, t0_idx: int | None = None) -> dict:
|
|
20
|
-
"""Convert from Xarray to NWP NumpyBatch"""
|
|
21
|
-
|
|
22
|
-
example = {
|
|
23
|
-
NWPBatchKey.nwp: da.values,
|
|
24
|
-
NWPBatchKey.nwp_channel_names: da.channel.values,
|
|
25
|
-
NWPBatchKey.nwp_init_time_utc: da.init_time_utc.values.astype(float),
|
|
26
|
-
NWPBatchKey.nwp_step: (da.step.values / pd.Timedelta("1h")).astype(int),
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if "target_time_utc" in da.coords:
|
|
30
|
-
example[NWPBatchKey.nwp_target_time_utc] = da.target_time_utc.values.astype(float)
|
|
31
|
-
|
|
32
|
-
# TODO: Do we need this at all? Especially since it is only present in UKV data
|
|
33
|
-
for batch_key, dataset_key in (
|
|
34
|
-
(NWPBatchKey.nwp_y_osgb, "y_osgb"),
|
|
35
|
-
(NWPBatchKey.nwp_x_osgb, "x_osgb"),
|
|
36
|
-
):
|
|
37
|
-
if dataset_key in da.coords:
|
|
38
|
-
example[batch_key] = da[dataset_key].values
|
|
39
|
-
|
|
40
|
-
if t0_idx is not None:
|
|
41
|
-
example[NWPBatchKey.nwp_t0_idx] = t0_idx
|
|
42
|
-
|
|
43
|
-
return example
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"""Convert Satellite to NumpyBatch"""
|
|
2
|
-
import xarray as xr
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class SatelliteBatchKey:
|
|
6
|
-
|
|
7
|
-
satellite_actual = 'satellite_actual'
|
|
8
|
-
satellite_time_utc = 'satellite_time_utc'
|
|
9
|
-
satellite_x_geostationary = 'satellite_x_geostationary'
|
|
10
|
-
satellite_y_geostationary = 'satellite_y_geostationary'
|
|
11
|
-
satellite_t0_idx = 'satellite_t0_idx'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def convert_satellite_to_numpy_batch(da: xr.DataArray, t0_idx: int | None = None) -> dict:
|
|
15
|
-
"""Convert from Xarray to NumpyBatch"""
|
|
16
|
-
example = {
|
|
17
|
-
SatelliteBatchKey.satellite_actual: da.values,
|
|
18
|
-
SatelliteBatchKey.satellite_time_utc: da.time_utc.values.astype(float),
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
for batch_key, dataset_key in (
|
|
22
|
-
(SatelliteBatchKey.satellite_x_geostationary, "x_geostationary"),
|
|
23
|
-
(SatelliteBatchKey.satellite_y_geostationary, "y_geostationary"),
|
|
24
|
-
):
|
|
25
|
-
example[batch_key] = da[dataset_key].values
|
|
26
|
-
|
|
27
|
-
if t0_idx is not None:
|
|
28
|
-
example[SatelliteBatchKey.satellite_t0_idx] = t0_idx
|
|
29
|
-
|
|
30
|
-
return example
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/data/uk_gsp_locations.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/__init__.py
RENAMED
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/ecmwf.py
RENAMED
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/ukv.py
RENAMED
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/load/nwp/providers/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/numpy_batch/sun_position.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/fill_time_periods.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/select_spatial_slice.py
RENAMED
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/select/select_time_slice.py
RENAMED
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler/torch_datasets/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/ocf_data_sampler.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ocf_data_sampler-0.0.23 → ocf_data_sampler-0.0.24}/tests/select/test_select_spatial_slice.py
RENAMED
|
File without changes
|
|
File without changes
|