Skip to content
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

Split ROMSComponent.input_datasets attribute up #95

Conversation

dafyddstephenson
Copy link
Contributor

The key goal here is to split ROMSComponent.input_datasets up into several more specific attributes, e.g. ROMSComponent.model_grid, closing #94 . This has implications in other places in the code.

It's already clear this is leading to a lot of reshuffling. I pondered for a good while yesterday how to split the various obstacles up, but they're pretty entangled, so I'm going to open this as a draft and push (non-working) commits to hopefully make it easier to follow along.

Problem 1

  • Description
    Case.from_blueprint creates all the objects that go into a component, including InputDataset objects, before creating the Component object itself from those objects. As such it already has some nasty logic that is hyper-specific to, e.g. ROMSComponent. Implementing this change to ROMSComponent.input_datasets will involve rewriting large parts of Case.from_blueprint, and it would make sense to hand off component-specific aspects like this to the relevant Component subclasses.

  • Attempted solution
    To start, I'm attempting to create a Component.from_dict class method, so that Case.from_blueprint can just call this method on each component in turn, passing the relevant subsection of the blueprint yaml file.

“Dafydd added 3 commits September 18, 2024 17:30
- Call these methods from inside `Case.from_blueprint` and `Case.persist`
- Remove reference to `input_datasets` in Component base class
- Add attributes model_grid, initial_conditions, surface_forcing, tidal_forcing, boundary_forcing on ROMSComponent
- Define from_dict on ROMSComponent calling super().from_dict before adding roms-specific attributes

Necessary refactoring:
- Redefine datasets_to_partition list in ROMSComponent.pre_run using these attributes
- Remove 'discretization' attr from base Component class (as not needed by MARBL)
- Move Discretization and ROMSDiscretization classes to their own modules
- Add __init__ and from_dict to MARBLComponent
- Remove "name" entry from blueprint under "base_model": 'name' is not a constructor arg to BaseModel class...
- ... Define "name" entry in blueprint at the component level instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant