Skip to content

Commit

Permalink
Merge pull request #184 from openclimatefix/fix-site-pvnet-get-datapipe
Browse files Browse the repository at this point in the history
Fix site pvnet datamodule get datapipe
  • Loading branch information
Sukh-P authored May 3, 2024
2 parents 08b79fb + 9f78a0f commit 803330a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pvnet/data/pv_site_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import glob

from ocf_datapipes.batch import BatchKey, batch_to_tensor, stack_np_examples_into_batch
from ocf_datapipes.training.pvnet_site import pvnet_site_netcdf_datapipe
from ocf_datapipes.training.pvnet_site import (
pvnet_site_datapipe,
pvnet_site_netcdf_datapipe,
split_dataset_dict_dp,
uncombine_from_single_dataset,
)

from pvnet.data.base import BaseDataModule

Expand All @@ -11,9 +16,13 @@ class PVSiteDataModule(BaseDataModule):
"""Datamodule for training pvnet site and using pvnet site pipeline in `ocf_datapipes`."""

def _get_datapipe(self, start_time, end_time):
data_pipeline = pvnet_site_netcdf_datapipe(
keys=["pv", "nwp"],
data_pipeline = pvnet_site_datapipe(
self.configuration,
start_time=start_time,
end_time=end_time,
)
data_pipeline = data_pipeline.map(uncombine_from_single_dataset).map(split_dataset_dict_dp)
data_pipeline = data_pipeline.pvnet_site_convert_to_numpy_batch()

data_pipeline = (
data_pipeline.batch(self.batch_size)
Expand Down

0 comments on commit 803330a

Please sign in to comment.