openclimatefix / uk-pvnet-app

Application for running PVNet in production
MIT License
1 stars 4 forks source link

fix for satellite check #107

Closed peterdudfield closed 3 months ago

peterdudfield commented 3 months ago

Pull Request

Description

Fix why satellite data wasnt checked The fix is to use hasattr not in

Small code that shows bug

from pvnet.models.base_model import BaseModel as PVNetBaseModel
from ocf_datapipes.config.load import load_yaml_configuration

name = "openclimatefix/pvnet_uk_region"
version = "aa73cdafd1db8df3c8b7f5ecfdb160989e7639ac"

data_config_filename = PVNetBaseModel.get_data_config(name, version)
data_config = load_yaml_configuration(data_config_filename)

assert "satellite" in data_config.input_data # this doesnt work
assert hasattr(data_config.input_data, "satellite") # this does

How Has This Been Tested?

Added a test and checked it failed with old code

Checklist: