CWorthy-ocean / C-Star

C-Star is a python package for setting up and running ocean model simulations, with a particular focus on marine carbon dioxide removal (mCDR) applications.
https://c-star.readthedocs.io
10 stars 4 forks source link

Refactor `Component` to split up `input_datasets` attribute? #94

Closed dafyddstephenson closed 2 weeks ago

dafyddstephenson commented 1 month ago

I've been thinking about how to incorporate the ability to restart a Case after running it. Effectively the only thing to change is the path to the initial condition file, which is currently a random entry in Component.input_datasets.

I am leaning towards the idea of splitting this attribute up, which I think is more sensible. For ROMS this would look like

ROMSComponent.model_grid: ROMSModelGrid
ROMSComponent.initial_conditions: ROMSInitialConditions
ROMSComponent.surface_forcing: List[ROMSSurfaceForcing]
ROMSComponent.tidal_forcing: ROMSTidalForcing
ROMSComponent.boundary_forcing: List[ROMSBoundaryForcing]

The InputDataset class and various subclasses used above still exist, but the input_datasets attribute on Component and ROMSComponent (currently a list) would not.

This would make namelist editing less fragile and make it very easy for C-Star to have methods on Case that run successive simulations with restarts.

@TomNicholas @NoraLoose thoughts?

TomNicholas commented 1 month ago

Seems like a good idea to me! If initial conditions sometimes need to be treated differently to other input datasets then makes sense to separate it out.