-
-
Notifications
You must be signed in to change notification settings - Fork 6
Tweak the way DataSources are represented in the Configuration model #217
Comments
perhaps the layout could be
|
Yeah, exactly! To flesh that out one more level deep:
I'm not entirely sure about the |
Also, it would be great if the field names in the config file exactly match the constructor arguments for each Should we keep the field name |
Yea I like the lay out above, I'm not quite sure how to do the 'default_forecast_minutes' from a model higher up, but we could have a play. In the idea of being verbose, I think keep it as zarr_path, and for PVDataSource, put both the filenames in> We can add a validator to make sure the filename or zarr_path has the right suffix |
Yeah, I wonder if we should keep things simple and users just have to put the BTW, are you happy to have a shot at this issue? Absolutely no worries either way - I'm happy to if you've got too much other stuff on this week! |
Yea - i'll give it a go |
Cheers, thank you! To give a bit more context... and don't necessarily worry about implementing this yet... but I guess the ultimate goal is that, in data_sources = get_data_sources(config.data_sources) And, def get_data_sources(config_for_all_data_sources) -> list[DataSource]:
data_source_name_to_class = {'satellite': SatelliteDataSource, 'nwp': NWPDataSource, ...}
data_sources = []
for data_source_name, data_source_class in data_source_name_to_class.items():
config_for_data_source = getattr(config_for_all_data_sources, data_source_name)
data_source = data_source_class(**config_for_data_source)
data_sources.append(data_source)
return data_sources |
That would be very neat indeed |
Detailed Description
We maybe want to make a few small changes to the Configuration model:
enabled_data_sources
NWP
section, with fields zarr_path, image_size, and channels.Context
Splitting up the Configuration so each data source has its own section should mean that we don't have to write custom code to translate between a Configuration object and the constructor for each DataSource. Instead we just do something like
SatDataSource(**config.sat_data)
The text was updated successfully, but these errors were encountered: