Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
fix in manager.py #631
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Apr 4, 2022
1 parent 3057f69 commit 49521d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 0 additions & 9 deletions nowcasting_dataset/data_sources/pv/pv_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ class PVDataSource(ImageDataSource):
defined by image_size_pixels and meters_per_pixel.
"""

# This are just keep in for the moment, but don't do anything.
# THey are needed for manager.py to work
# TODO: #631
filename = None
metadata_filename = None

files_groups: List[Union[PVFiles, dict]]
# TODO: Issue #425: Use config to set start_dt and end_dt.
start_datetime: Optional[datetime.datetime] = None
Expand All @@ -54,9 +48,6 @@ class PVDataSource(ImageDataSource):
def __post_init__(self, image_size_pixels: int, meters_per_pixel: int):
"""Post Init"""

assert self.filename is None
assert self.metadata_filename is None

if type(self.files_groups[0]) == dict:
self.files_groups = [PVFiles(**files) for files in self.files_groups]

Expand Down
11 changes: 10 additions & 1 deletion nowcasting_dataset/manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,20 @@ def initialize_data_sources(
config_for_data_source, pattern_to_remove=f"^{data_source_name}_"
)

# TODO: #631 remove
if data_source_name == "pv":
config_for_data_source.pop("filename")
config_for_data_source.pop("metadata_filename")

data_source_class = MAP_DATA_SOURCE_NAME_TO_CLASS[data_source_name]
try:
data_source = data_source_class(**config_for_data_source)
except Exception:
logger.exception(f"Exception whilst instantiating {data_source_name}!")
logger.exception(
f"Exception whilst instantiating {data_source_name}! "
f"Tried with configuration {config_for_data_source} "
f"in {data_source_class}"
)
raise
self.data_sources[data_source_name] = data_source

Expand Down

0 comments on commit 49521d8

Please sign in to comment.