-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from CliMA/ne/model_interface
Simplify model interface and remove experiment ID
- Loading branch information
Showing
17 changed files
with
88 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,37 @@ | ||
import EnsembleKalmanProcesses as EKP | ||
import YAML | ||
|
||
""" | ||
AbstractPhysicalModel | ||
|
||
Abstract type to define the interface for physical models. | ||
""" | ||
abstract type AbstractPhysicalModel end | ||
set_up_forward_model(member, iteration, experiment_dir::AbstractString) | ||
set_up_forward_model(member, iteration, experiment_config::ExperimentConfig) | ||
""" | ||
get_config(physical_model::AbstractPhysicalModel, member, iteration, experiment_path::AbstractString) | ||
get_config(physical_model::AbstractPhysicalModel, member, iteration, experiment_config) | ||
Set up and configure a single member's forward model. Used in conjunction with `run_forward_model`. | ||
Fetch the model information for a specific ensemble member and iteration based on a provided path. | ||
This function must be overriden by a component's model interface and | ||
should set things like the parameter path and other member-specific settings. | ||
""" | ||
function get_config( | ||
physical_model::AbstractPhysicalModel, | ||
member, | ||
iteration, | ||
experiment_path::AbstractString, | ||
) | ||
experiment_config = ExperimentConfig(experiment_path) | ||
return get_config(physical_model, member, iteration, experiment_config) | ||
end | ||
set_up_forward_model(member, iteration, experiment_dir::AbstractString) = | ||
set_up_forward_model(member, iteration, ExperimentConfig(experiment_dir)) | ||
|
||
get_config( | ||
physical_model::AbstractPhysicalModel, | ||
member, | ||
iteration, | ||
experiment_config, | ||
) = error("get_config not implemented for $physical_model") | ||
set_up_forward_model(member, iteration, experiment_config::ExperimentConfig) = | ||
error("set_up_forward_model not implemented") | ||
|
||
""" | ||
run_forward_model(physical_model::AbstractPhysicalModel, config) | ||
run_forward_model(config) | ||
Executes the forward model simulation with the given configuration. | ||
The `config` should be obtained from `get_config`. | ||
`config` should be obtained from `set_up_forward_model`. | ||
This function should be overridden with model-specific implementation details. | ||
""" | ||
run_forward_model(physical_model::AbstractPhysicalModel, model_config) = | ||
error("run_forward_model not implemented for $physical_model") | ||
|
||
""" | ||
get_forward_model(experiment_id::Val) | ||
Retrieves a custom physical model struct for the specified experiment ID. | ||
Throws an error if the experiment ID is unrecognized. | ||
""" | ||
function get_forward_model(experiment_id::Val) | ||
error("get_forward_model not implemented for $experiment_id") | ||
end | ||
run_forward_model(model_config) = error("run_forward_model not implemented") | ||
|
||
""" | ||
observation_map(val:Val, iteration) | ||
Runs the observation map for the specified iteration. | ||
This function must be implemented for each calibration experiment. | ||
""" | ||
function observation_map(val::Val, iteration) | ||
error( | ||
"observation_map not implemented for experiment $val at iteration $iteration", | ||
) | ||
function observation_map(iteration) | ||
error("observation_map not implemented") | ||
end |
Oops, something went wrong.