-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch / Sample class - draft #125
base: main
Are you sure you want to change the base?
Conversation
To mention, any point in updating type hints to be effectively more robust? I.e. using TypeVar: T = TypeVar('T', bound='SampleBase')
ArrayType = Union[np.ndarray, torch.Tensor, xr.DataArray]
class SampleBase(ABC, Generic[T]):
def to_torch(self) -> T: Suppose important for early and type related errors, particularly with multiple refactors. |
Updates implemented @Sukh-P |
Further update @Sukh-P - purely updating uk_regional.py - numbered file saving and loading similar to the reference logic provided:
Previous function before this specific update (also pre-change init) left in uk_regional.py - just to check this is all in line with overall requirements here. |
REQUIRED_KEYS = { | ||
'nwp', | ||
GSPSampleKey.gsp, | ||
SatelliteSampleKey.satellite_actual, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be optional
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be duplicate, to check
|
||
# Fixture define | ||
@pytest.fixture | ||
def pvnet_config_filename(tmp_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to json, check not in conftest already
|
||
def plot(self, **kwargs) -> None: | ||
""" Sample visualisation definition """ | ||
logger.debug("Creating PVNetSample visualisation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could update later using ocf-datapipes visulation.
logger.error(f"Invalid key type: {type(key)}") | ||
raise TypeError(f"Key must be str or int, got {type(key)}") | ||
|
||
# REFERENCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
GSPSampleKey.solar_elevation | ||
} | ||
|
||
# REFERENCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
Overview
First stages of a standardised sample handling system, with unified interface across different dataset types - refer to issue #71. Initial focus regarding Dataset type is PVNet UK Regional. As of the moment, base.py and uk_regional.py function as effective parent and child classes, respectively.
Main Implementation
base.py
uk_regional.py